Resolving "LambdaThrottledException" Error with Amazon Cognito Events and AWS Lambda

Implementing Action to Resolve "LambdaThrottledException" Error

Prev Question Next Question

Question

You are working on a POC for a new gaming application in us-east-1 region which will be using Amazon Cognito Events to execute AWS Lambda function.

AWS Lambda function will issue a winning badge for a player post reaching every new level.

You are getting error as “LambdaThrottledException” for certain cases when you are performing application testing with large number of players.

Which of the following action needs to be implemented to resolve this error message?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Correct Answer - C.

To resolve “LambdaThrottledException” error while using Amazon Cognito Events, you need to perform retry on sync operations while writing Lambda function.

Option A is incorrect as If a Lambda Function does not respond in 5 sec, “LambdaSocketTimeoutException” error will be generated & not “LambdaThrottledException”

OptionB is incorrect as this will not generate error “LambdaThrottledException”.

OptionD is incorrect as If you are updating other fields, this will result in failure in updating records & not generate error “LambdaThrottledException”.

For more information on Amazon Cognito Events, refer to the following URL,

https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-events.html

The error message "LambdaThrottledException" indicates that AWS Lambda is unable to process all of the requests that it is receiving, because it has reached its concurrency limit. In other words, Lambda is currently handling as many requests as it can, and it cannot handle any more until some of the current requests have completed.

To resolve this error message, you need to take steps to reduce the number of requests being sent to Lambda, or increase the capacity of Lambda to handle more requests.

Option A, "Make sure Lambda Function responds in 5 sec", is not a solution to the problem, as it does not address the underlying issue of Lambda being throttled due to high concurrency. While it is important to optimize the performance of your Lambda function, reducing the response time to 5 seconds may not be possible or practical for all use cases.

Option B, "Make sure Amazon Cognito provides all records in a dataset as input to the function", is not relevant to the problem, as it pertains to the input data provided to the Lambda function rather than the Lambda concurrency issue.

Option C, "Modify the Lambda function to enable retry when writing the function for the Sync Trigger event", is a potential solution to the problem. By enabling retry for the Lambda function, you can ensure that any failed requests are retried automatically, reducing the likelihood of requests being dropped due to throttling. This approach may require some additional configuration and testing to ensure that retries are handled correctly and do not result in duplicate or conflicting updates.

Option D, "Make sure you are updating “datasetRecords” field & not any other fields", is also not relevant to the problem, as it pertains to the data being updated by the Lambda function rather than the Lambda concurrency issue.

Therefore, the correct answer is C: Modify the Lambda function to enable retry when writing the function for the Sync Trigger event.