AWS Certified Developer – Associate / Question #1031 of 557

Question #1031

A team uses Amazon API Gateway to manage a REST API with a single resource and a POST method integrated with an AWS Lambda function. A developer updates the Lambda function and publishes it as a new version. The team needs to validate the new version in a testing environment without impacting the production API. The solution must minimize operational complexity.

Which approach meets these requirements with the LEAST operational overhead?

A

Create a new resource in the existing REST API. Configure a POST method for the new resource linked to the updated Lambda version. Deploy the changes to the existing stage.

B

Create a new stage for the REST API. Define a stage variable referencing the updated Lambda version. Configure the API Gateway Lambda integration to use the stage variable. Deploy the API to the new stage.

C

Build a new REST API. Add a resource with a POST method integrated with the updated Lambda version. Deploy the new API and test it independently.

D

Modify the existing POST method's Lambda integration to point to the updated Lambda version. Deploy the changes to the current stage.

Explanation

Answer B is correct because:
- Stage Variables: By creating a new stage (e.g., 'testing'), the team can use a stage variable to dynamically reference the updated Lambda version. This avoids modifying the production stage.
- Isolation: The new stage provides a separate environment for testing, ensuring production traffic remains unaffected.
- Operational Simplicity: Reusing the existing API configuration reduces overhead compared to rebuilding an API (Option C) or modifying production resources (Options A and D).

Other options fail because:
- A: Deploying to the existing stage would impact production.
- C: Building a new API introduces unnecessary complexity.
- D: Directly modifying the production integration risks disrupting live traffic.

Key Takeaway: Use API Gateway stages and stage variables to test Lambda versions safely and efficiently.

Answer

The correct answer is: B