DVA-C02 Question 308
Single answerYou are developing an API with Amazon API Gateway and have deployed it to multiple stages: dev, staging, and prod. Your team wants to expose the prod stage under the custom domain 'api.example.com', while keeping the dev and staging stages accessible only via their default stage URLs. How can you achieve this?
- A
Configure the custom domain 'api.example.com' and map it to the
prodstage in API Gateway. - B
Create a custom domain 'api.example.com' and map it to all three stages:
dev,staging, andprod. - C
Assign each stage (
dev,staging, andprod) a unique custom domain and SSL certificate. - D
Use Route 53 to create a DNS record that maps 'api.example.com' to the default URL of the
prodstage.
Show answer and explanation
Correct answer: A
Explanation
To expose a specific API Gateway stage under a custom domain, you configure the custom domain and map it to the desired stage within API Gateway. This allows you to control which stage is associated with the custom domain and ensures that other stages remain accessible only via their default URLs.
- A. Correct.
Correct. You can configure a custom domain in API Gateway and map it specifically to the
prodstage. This approach satisfies the requirement of exposing only theprodstage under the custom domain. - B. Incorrect.
Incorrect. Mapping the custom domain to all three stages would contradict the requirement of keeping
devandstagingstages accessible only via their default URLs. - C. Incorrect.
Incorrect. While you can assign unique custom domains to each stage, this approach is unnecessary and does not meet the requirement of exposing only the
prodstage under 'api.example.com'. - D. Incorrect.
Incorrect. Route 53 can be used to create DNS records, but it cannot directly map a custom domain to a specific stage in API Gateway. This configuration must be done within API Gateway.