Lambda-to-Lambda Async Invocation

Dharmendra S Negi
2 min readJan 21, 2024

Many AWS services, such as Amazon Simple Notification Service (Amazon SNS) , Amazon Simple Storage Service (Amazon S3) and DynamoDB Streams , invoke functions asynchronously to process events. You hand off the event to Lambda and Lambda handles the rest.

In this blog article, we will look at how to make lambda-to-lambda asynchronous calls.

First, what is the difference between synchronous and asynchronous invocation?

Synchronous calls: When you call a function synchronously, Lambda executes it and awaits a response. When the function is finished, Lambda returns the response from the function’s code along with extra information, such as the function version that was called.

Asynchronous calls: When you call a function asynchronously, you do not wait for a response from the function code. Lambda adds the event to a queue before sending it to your function.

Let’s see how we can make asynchronous calls to lambda.

To invoke a function asynchronously, set InvocationType to Event

FunctionName: "Your_Function_Name",
InvocationType: "Event",
ClientContext: "STRING_VALUE",
Payload: "test",
Qualifier: "STRING_VALUE"

When making asynchronous calls, Lambda places the event in a queue and immediately responds with a success acknowledgment, offering no additional information. A separate process is then responsible for retrieving events from the queue and forwarding them to the specified function.

Invocation response:

StatusCode: "202",

StatusCode 202 means — the request has been accepted for processing, but the processing has not been finished yet

Things to know when making asynchronous calls:

Auto Retry: Lambda manages the function’s asynchronous event queue and attempts to retry on errors. If the function returns an error, Lambda makes two additional attempts to run the function. The first two attempts have a one-minute interval between them, while the third attempt occurs after a two-minute wait following the second attempt.

Queue Time: Maximum time Lambda keeps an event in the asynchronous event queue, up to 6 hours. And When the queue is very long, new events may time out before Lambda has a chance to dispatch them to your function.

Queue Type: Queue is eventually consistent, so a function can receive the same event from Lambda multiple times. Make sure your function code handles duplicate events correctly.

Event Payload: Be mindful of the size and structure of the event payload, as AWS Lambda has limitations on payload size.

Invocation Type: Specify the invocation type as “Event” when setting up asynchronous invocations. This indicates that you don’t require a response immediately.

Concurrency Limits: Be aware of Lambda concurrency limits, which may affect the number of parallel executions of your function. Adjust settings based on your workload requirements.

Hello, I’m Dharmendra. Thank you for reading, I hope this blog will help you get the understanding of AWS Lambda Asynchronous invocation. If you have any questions, feel free to DM me and I’ll be happy to assist.