DVA-C02 Question 311
Select 4You are developing a serverless application using AWS API Gateway and Lambda. Your application has multiple environments, including 'dev', 'test', and 'prod', which are configured as API Gateway stages. You want to configure a custom domain name for your API so that users can access different stages using URLs like https://api.example.com/dev and https://api.example.com/prod. What steps should you take to achieve this?
- A
Create a custom domain name in API Gateway and associate it with your API.
- B
Create base path mappings for each stage ('dev', 'test', 'prod') to map them to the custom domain.
- C
Associate the custom domain with an ACM certificate in the same AWS Region.
- D
Deploy the API Gateway stages and configure DNS records in Route 53 to point to the custom domain.
- E
Configure a VPC endpoint for API Gateway to route traffic to the custom domain.
Show answer and explanation
Correct answers: A, B, C, D
Explanation
To use a custom domain with API Gateway stages, you must create the custom domain name, associate it with an ACM certificate for HTTPS, and configure base path mappings to route requests to the correct stages. After deploying the stages, you need to configure DNS (e.g., via Route 53) to point to API Gateway. However, configuring a VPC endpoint is not necessary for API Gateway custom domain setups.
- A. Correct.
Correct. You need to create a custom domain name in API Gateway to use your own domain for accessing the API.
- B. Correct.
Correct. Base path mappings are required to route requests to the appropriate API Gateway stages when using a custom domain.
- C. Correct.
Correct. The custom domain name must be associated with an ACM certificate in the same AWS Region to enable HTTPS access.
- D. Correct.
Correct. Deploying the stages makes them accessible, and you must configure DNS records (e.g., in Route 53) to point the domain to API Gateway.
- E. Incorrect.
Incorrect. VPC endpoints are not required for API Gateway custom domain configurations, as API Gateway handles traffic routing without needing a VPC endpoint.