AWS Certified Developer – Associate / Question #1049 of 557

Question #1049

A company operates a serverless web application using an Amazon API Gateway REST API integrated with an AWS Lambda function. Users have reported increased latency during the initial invocation of the Lambda function, which the development team traced to cold starts. The team needs to minimize the initialization delays to improve user experience.

Which solution will address this issue effectively?

A

Enable reserved concurrency for the Lambda function to limit scaling.

B

Adjust the Lambda function's timeout settings to a higher value.

C

Optimize the Lambda function's code to reduce its package size.

D

Enable provisioned concurrency for the Lambda function.

Explanation

Answer D is correct because provisioned concurrency keeps Lambda function instances initialized and ready to respond, eliminating cold start delays. Cold starts occur when AWS must set up a new execution environment, which adds latency.

Why other options are incorrect:
- A: Reserved concurrency limits scaling but does not pre-warm instances.
- B: Increasing timeout does not address initialization delays; it only extends execution time.
- C: Reducing package size may slightly speed up cold starts but does not prevent them.

Key Points:
- Cold starts are caused by initialization of new Lambda instances.
- Provisioned concurrency maintains 'warm' instances to handle requests immediately.
- This solution directly targets the root cause of the reported latency issue.

Answer

The correct answer is: D