AWS Certified Developer – Associate (DVA-C02) — Question 128
A company is developing an ecommerce application that uses Amazon API Gateway APIs. The application uses AWS Lambda as a backend. The company needs to test the code in a dedicated, monitored test environment before the company releases the code to the production environment.
Which solution will meet these requirements?
Answer options
- A. Use a single stage in API Gateway. Create a Lambda function for each environment. Configure API clients to send a query parameter that indicates the environment and the specific Lambda function.
- B. Use multiple stages in API Gateway. Create a single Lambda function for all environments. Add different code blocks for different environments in the Lambda function based on Lambda environment variables.
- C. Use multiple stages in API Gateway. Create a Lambda function for each environment. Configure API Gateway stage variables to route traffic to the Lambda function in different environments.
- D. Use a single stage in API Gateway. Configure API clients to send a query parameter that indicates the environment. Add different code blocks for different environments in the Lambda function to match the value of the query parameter.
Correct answer: C
Explanation
Option C is correct because it allows the use of multiple stages in API Gateway and distinct Lambda functions for each environment, which effectively isolates testing environments. Option A incorrectly suggests using a single stage and requires multiple Lambda functions to be selected through query parameters, complicating the implementation. Option B fails to create separate functions for each environment, which can lead to issues with environment-specific code. Option D also uses a single stage and query parameters, which is not ideal for maintaining clear separation of environments.