DVA-C02 Question 268
Single answerA developer is managing an API in Amazon API Gateway and wants to deploy it to different environments like 'development', 'staging', and 'production'. They want to ensure that each environment has its own endpoint and can be managed independently. Which feature of API Gateway should the developer use to achieve this?
- A
Deploy separate APIs for each environment.
- B
Use API Gateway stages to manage different environments.
- C
Create separate API Gateway accounts for each environment.
- D
Use Lambda versions and aliases instead of API Gateway stages.
Show answer and explanation
Correct answer: B
Explanation
API Gateway stages are designed to help developers create and manage multiple environments for a single API. Each stage has a unique endpoint and can be configured independently, making it the best approach for managing environments like 'development', 'staging', and 'production'.
- A. Incorrect.
Deploying separate APIs for each environment would require redundant configuration and management. This is not a recommended approach as API Gateway stages are designed for this purpose.
- B. Correct.
API Gateway stages are specifically designed to enable developers to create different environments such as 'development', 'staging', and 'production'. Each stage has its own URL endpoint and can be independently configured and managed.
- C. Incorrect.
Creating separate API Gateway accounts for each environment adds unnecessary complexity and is not required. API Gateway stages provide a more efficient solution.
- D. Incorrect.
Lambda versions and aliases can be used for versioning Lambda functions, but they do not provide the environment management capabilities that API Gateway stages offer.