Question

Difficulty: MediumDeployment Strategies

A developer has a production API hosted on Amazon API Gateway and wants to introduce a new API version. To minimize risk, the developer needs to route 5%5\% of the API traffic to the new version using the same endpoint, while the remaining 95%95\% continues to go to the current version. The developer wants to monitor the performance of the new version and must be able to immediately roll back all traffic to the current version if any anomalies are detected. Which deployment approach should the developer use to meet these requirements?

  1. A
    Deploy the new API version to a new stage, configure a Route 53 weighted routing policy with a 5%5\% weight pointing to the new stage's endpoint, and decrease the TTL to zero for immediate rollback.
  2. B
    Deploy the new API version to a new stage, configure an Application Load Balancer with weighted target groups routing 5%5\% of traffic to the new stage, and modify the target group weights to 0%0\% to roll back.
  3. Enable canary settings on the existing API Gateway stage, set the canary traffic percentage to 5%5\%, and delete the canary deployment if any anomalies are detected.Answer
  4. D
    Create a Route 53 failover routing policy that designates the current stage as primary and the new stage as secondary, and configure a CloudWatch alarm to trigger the failover.

Answer

Enable canary settings on the existing API Gateway stage, set the canary traffic percentage to 5%5\%, and delete the canary deployment if any anomalies are detected.
Enabling canary settings on an existing API Gateway stage allows a developer to route a small percentage of traffic (such as 5%5\%) to a new deployment using the same endpoint. If anomalies occur, deleting the canary deployment immediately routes all traffic back to the stable production version, satisfying the rollback requirement.

Step-by-Step Solution

1
Identify the requirement for percentage-based traffic routing on a single API endpoint.
The solution must support shifting 5%5\% of traffic to the new version and 95%95\% to the current version under the same stage endpoint.
Clients must access the API using the existing configuration without needing distinct URLs.
2
Evaluate the native deployment capabilities of Amazon API Gateway.
API Gateway offers stage-level canary settings, allowing traffic to be split between a production deployment and a canary deployment on the same stage.
This avoids external routing layers and provides native support for canary testing.
3
Determine the optimal rollback mechanism.
If anomalies occur, deleting the canary settings or deployment on the stage immediately redirects all traffic back to the primary production deployment.
This ensures the rollback is instantaneous, meeting the requirement without suffering from DNS propagation delays.

Key Concept

API Gateway Canary Deployments
Estimated Time:1m 15s
Rate this question