AWS Certified Developer – Associate (DVA-C02) — Question 165
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
The primary benefit of initializing the AWS SDK outside the Lambda handler is that it allows the SDK to take advantage of the reuse of the runtime environment, which can lead to faster execution times. Options A, C, and D do not address the performance improvements associated with SDK initialization in the context of Lambda's execution model.