Monday, May 22, 2023
HomeSoftware EngineeringEasy methods to Invoke an AWS Lambda from the CLI

Easy methods to Invoke an AWS Lambda from the CLI

If you wish to invoke an AWS Lambda out of your CLI, then the best choice is to have the AWS CLI put in.

Getting began with the AWS CLI – AWS Command Line Interface (

As soon as that is put in, you’ll be able to invoke Lambdas as follows:

Setting your AWS Area

It is suggested to at all times set your AWS area in an surroundings variable referred to as AWS_REGION

export AWS_REGION=eu-west-1
aws lambda invoke --function-name YourFunction --region ${AWS_REGION} --cli-binary-format raw-in-base64-out --payload '{"keyName":"keyValue"}' response.json

Possibility 2 – If it’s worthwhile to use AWS CLI v1

aws lambda invoke --function-name YourFunction --region ${AWS_REGION} --payload $(echo '{"keyName":"keyValue"}') response.json


We specified a response.json on the finish of the above instructions. That is to get the output from the Lambda run.

It’s also possible to see detailed logs immediately within the CloudWatch group related to the above Lambda operate.



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments