How to Configure API Gateway Stage-Specific Third-Party Endpoints?
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?
Community Votes
100% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
This question tests your knowledge of API Gateway stage variables as the native, purpose-built mechanism for injecting stage-specific configuration into integration requests.
Amazon API Gateway stage variables allow you to store environment-specific configuration such as third-party service endpoints, enabling a single Lambda function to route to different backends per deployment stage.
Candidates often choose AWS AppConfig (D) because it is a valid AWS configuration service, but it introduces unnecessary complexity and is not the native API Gateway feature designed for per-stage endpoint mapping.
Community Discussion (4 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why Option B is Correct
Amazon API Gateway stage variables are key-value pairs that are scoped to a specific deployment stage (dev, UAT, prod). You can reference them in integration URIs, header mappings, and query strings using the syntax $stageVariables.variableName. This makes them the native, simplest, and most cost-effective way to point each stage to a different third-party endpoint without changing Lambda code or adding extra services.
Why the Other Options Are Wrong
- Option A – Lambda layers: Lambda layers are meant for sharing libraries, dependencies, or custom runtimes, not for storing runtime configuration that changes per stage. A layer is tied to a Lambda function version, not an API Gateway stage.
- Option C – Query parameters: Encoding endpoints as query parameters exposes internal infrastructure details in the URL, is less secure, and conflates client-supplied data with server-side routing configuration.
- Option D – AWS AppConfig: While AppConfig can store configuration, it requires additional setup (hosted configuration profiles, deployment strategies) and is overkill for simple per-stage endpoint mapping. Stage variables are already built into API Gateway and require zero extra infrastructure.
Community Consensus
The community voted 100% for B. Commenters noted that stage variables are explicitly designed for this use case and linked the official API Gateway documentation confirming the feature. One commenter correctly pointed out that query parameters are for sending data to an endpoint, not for configuring which endpoint to call.
Related Analysis
Practice All DVA-C02 Questions
Access 100 questions with complete answers and detailed explanations.
View Full DVA-C02 Practice Test →