AWS Certified Developer – Associate (DVA-C02) — Question 371
A developer updates an AWS Lambda function that an Amazon API Gateway API uses. The API is the backend for a web application.
The developer needs to test the updated Lambda function before deploying the Lambda function to production. The testing must not affect any production users of the web application.
Which solution will meet these requirements in the MOST operationally efficient way?
Answer options
- A. Create a canary release deployment for the existing API stage. Deploy the API to the existing stage. Test the updated Lambda function by using the existing URL.
- B. Update the API Gateway API endpoint type to private. Deploy the changes to the existing API stage. Test the API by using the existing URL.
- C. Create a new test API stage in API Gateway. Add stage variables to deploy the updated Lambda function to only the test stage. Test the updated Lambda function by using the new stage URL.
- D. Create a new AWS CloudFormation stack to deploy a copy of the entire production API and Lambda function. Use the stack's API URL to test the updated Lambda function.
Correct answer: C
Explanation
Creating a new API Gateway stage and using stage variables to route to the updated Lambda function is the most operationally efficient method to isolate testing without disrupting production traffic. Option A (canary) would still route a portion of real production traffic to the untested code. Option B disrupts production access by making the API private, while Option D introduces unnecessary administrative overhead by copying the entire infrastructure.