AWS Certified Solutions Architect – Professional (SAP-C02) — Question 481

A company is developing a latency-sensitive application. Part of the application includes several AWS Lambda functions that need to initialize as quickly as possible. The Lambda functions are written in Java and contain initialization code outside the handlers to load libraries, initialize classes, and generate unique IDs.

Which solution will meet the startup performance requirement MOST cost-effectively?

Answer options

Correct answer: D

Explanation

AWS Lambda SnapStart is a free feature that significantly reduces startup latency for Java functions by utilizing cached snapshots of initialized environments, making it highly cost-effective compared to Provisioned Concurrency. Because SnapStart captures the initialized state of the JVM, any logic that generates unique data (such as unique IDs) must be moved inside the handler or managed with runtime hooks to prevent duplicate values across invocations. Option D correctly implements these code changes and enables SnapStart on published versions, which is required since SnapStart does not support the $LATEST version.