DVA-C02 · Question #488
A team has an Amazon API Gateway REST API that consists of a single resource and a GET method that is backed by an AWS Lambda integration. A developer makes a change to the Lambda function and deploys
The correct answer is B. Create a new stage for the REST API. Create a stage variable. Assign the stage variable to the. API Gateway stage variables allow different Lambda function versions or aliases to be invoked per stage, enabling canary testing of a new Lambda version on a separate stage without touching production.
Question
A team has an Amazon API Gateway REST API that consists of a single resource and a GET method that is backed by an AWS Lambda integration. A developer makes a change to the Lambda function and deploys the function as a new version. The developer needs to set up a process to test the new version of the function before using the new version in production. The tests must not affect the production REST API. Which solution will meet these requirements with the LEAST operational overhead?
Options
- ACreate a new resource in the REST API. Add a GET method to the new resource, and add a
- BCreate a new stage for the REST API. Create a stage variable. Assign the stage variable to the
- CCreate a new REST API. Add a resource that has a single GET method that is integrated with the
- DUpdate the Lambda integration of the existing GET method to point to the updated version of the
How the community answered
(43 responses)- A16% (7)
- B70% (30)
- C9% (4)
- D5% (2)
Why each option
API Gateway stage variables allow different Lambda function versions or aliases to be invoked per stage, enabling canary testing of a new Lambda version on a separate stage without touching production.
Adding a new resource to the existing REST API changes the production API's structure and requires redeployment of the production stage, which could affect production users.
By creating a new stage (e.g., 'test') and configuring a stage variable that references the new Lambda function version, the integration can use ${stageVariables.functionVersion} to route traffic to the correct version; the production stage continues using the previous version, completely isolating the test from production with minimal operational overhead.
Creating an entirely new REST API duplicates configuration, requires separate domain setup, and introduces significant operational overhead compared to using stage variables on the existing API.
Updating the Lambda integration of the existing GET method to the new version immediately affects all stages including production, which violates the requirement to not affect the production REST API.
Concept tested: API Gateway stage variables for Lambda version routing
Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/aws-api-gateway-stage-variables-reference.html
Community Discussion
No community discussion yet for this question.