简体   繁体   中英

Does AWS Lambda retires out of the box after a timeout during event based invocation from DynamoDB

I have a lambda function that pulls data from the event stream from DynamoDB. Inside the lambda function, I have a REST call to one of the internal API endpoint. The current timeout set for Lambda is 60 seconds.

Problem: In logs I am noticing that once in a while Lambda throws a timeout exception. It might be because my API did not process the request within 60 seconds.

Question: I want to understand in case lambda times out then what happens to events and calls that are being sent to the internal API/ REST Calls. Will those calls/events will be retried and sent again to the API out of the box?

I read below links:

https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventsourcemapping.html

AWS Lambda processing stream from DynamoDB

but I am not able to comprehend whether the API will receive those events/calls again.

For context, this question is about DynamoDB Streams and AWS Lambda triggers. Specifically, how the AWS Lambda service handles failed or timed out event handling by Lambda functions that were invoked by the Lambda service to handle events in DynamoDB Streams.

Per the Using AWS Lambda with Amazon DynamoDB documentation:

If your [Lambda] function returns an error, Lambda retries the batch [of DynamoDB Streams events] until processing succeeds or the data expires.

Lambda treats all other results [anything but complete success] as a complete failure and retries processing the batch up to the retry limit.

So, I would infer that a timeout is not a complete success and hence the entire batch is retried.

By the way, you mentioned "I have a lambda function that pulls data from the event stream from DynamoDB" but this is not actually how the DynamoDB Streams / Lambda integration works. The Lambda service polls the DynamoDB Stream and then invokes your Lambda function, pushing the DynamoDB data to you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM