AWS Certified Developer – Associate — Question 369
A developer is building a serverless application that is based on AWS Lambda. The developer initializes the AWS software development kit (SDK) outside of the
Lambda handler function.
What is the PRIMARY benefit of this action?
Answer options
- A. Improves legibility and stylistic convention
- B. Takes advantage of runtime environment reuse
- C. Provides better error handling
- D. Creates a new SDK instance for each invocation
Correct answer: B
Explanation
Initializing the AWS SDK outside the handler function allows the instance to be cached and reused across multiple warm invocations of the same execution environment. This significantly reduces latency and boot time by avoiding the overhead of re-initializing the SDK for every single request. Other benefits, such as code readability, are secondary to this primary performance optimization.