AWS Certified Developer – Associate (DVA-C02) — Question 276
A company runs a batch processing application by using AWS Lambda functions and Amazon API Gateway APIs with deployment stages for development, user acceptance testing, and production. A development team needs to configure the APIs in the deployment stages to connect to third-party service endpoints.
Which solution will meet this requirement?
Answer options
- A. Store the third-party service endpoints in Lambda layers that correspond to the stage.
- B. Store the third-party service endpoints in API Gateway stage variables that correspond to the stage.
- C. Encode the third-party service endpoints as query parameters in the API Gateway request URL.
- D. Store the third-party service endpoint for each environment in AWS AppConfig.
Correct answer: B
Explanation
API Gateway stage variables act as environment variables and can be configured to dynamically pass different values, such as third-party endpoints, to backend Lambda functions depending on the active stage. Using Lambda layers or query parameters for environment-specific endpoints is inefficient and introduces security and maintenance overhead. While AWS AppConfig can manage configurations, API Gateway stage variables are the native and simplest way to parameterize stage-specific endpoints directly within API Gateway.