Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to invoke asynchronous Lambda function using aws cli

I have created a asynchronous lambda function that is running fine when I am testing it on aws console. It is taking 6-7 mins to complete the execution. But when I am calling the same function from my local aws cli it is showing the below output.

Read timeout on endpoint URL: "https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/mandrill/invocations"

Any idea whats going wrong and how can I resolve that. The command I am using to invoke this function from cli is below,

aws lambda invoke --invocation-type RequestResponse --function-name mandrill --region us-east-1 --payload "{ \"domain\": \"faisal999.wombang.com\" }" --cli-binary-format raw-in-base64-out response.json
like image 678
Faisal Shani Avatar asked Jul 22 '26 03:07

Faisal Shani


1 Answers

To invoke a function asynchronously, set InvocationType to Event.

aws lambda invoke --invocation-type Event --function-name mandrill --region us-east-1 --payload "{ \"domain\": \"faisal999.wombang.com\" }" --cli-binary-format raw-in-base64-out response.json

Additionally, consider the following:

For asynchronous invocation , Lambda adds events to a queue before sending them to your function. If your function does not have enough capacity to keep up with the queue, events may be lost. Occasionally, your function may receive the same event multiple times, even if no error occurs. To retain events that were not processed, configure your function with a dead-letter queue .

like image 152
OARP Avatar answered Jul 24 '26 18:07

OARP



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!