Q59 — AWS DVA-C02 Ch.2
Question 59 of 100 | ← Chapter 2
A company uses AWS Lambda functions and an Amazon API Gateway API to run a batch processing application, deploying across stages such as development, user acceptance testing (UAT), and production. A development team needs to configure the API to connect to different backend service endpoints per deployment stage. Which solution satisfies this requirement?
- A. Store stage-specific third-party service endpoints in a Lambda layer.
- B. Store stage-specific third-party service endpoints in API Gateway stage variables. ✓
- C. Encode third-party service endpoints as query parameters in the API Gateway request URL.
- D. Store third-party service endpoints for each environment in AWS AppConfig.
Correct Answer: B. Store stage-specific third-party service endpoints in API Gateway stage variables.
Explanation
API Gateway stage variables provide a native, simple, and secure way to define environment-specific configuration values (e.g., backend endpoints) per deployment stage (dev, uat, prod). These variables are accessible in API Gateway mappings and can be passed to backend integrations—including Lambda functions—without code changes across environments. Lambda layers (Option A) are immutable per version and not stage-aware. Query parameters (Option C) expose endpoints in URLs and lack security and manageability. AWS AppConfig (Option D) adds unnecessary complexity and latency for static, stage-bound configuration. Thus, Option B is the most appropriate, flexible, and AWS-native solution.