How to Configure API Gateway Stage-Specific Third-Party Endpoints?
Short answer
B Store the third-party service endpoints in API Gateway stage variables that correspond to the stage.
Question
Key Takeaways
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.
Common mistake: 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.
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.
Community Votes
100% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 4 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 4
-
KarBiswa 👍 3 Answered Bhttps://docs.aws.amazon.com/apigateway/latest/developerguide/amazon-api-gateway-using-stage-variables.html
-
CrescentShared 👍 1 Answered BD: additional complex C: this is typically used to send data to the end point. Not to configure the endpoint itself. Less secure.
-
65703c1 👍 2 Answered BB is the correct answer.
-
ANDRES715 👍 2 Answered BYou.com y chatGpt
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All DVA-C02 Questions
Access 100 questions with complete answers and detailed explanations.
View Full DVA-C02 Practice Test →