Question #826
A developer is updating an AWS Lambda function with a new feature and wants to test it in production using 10% of the traffic. The Lambda function is integrated with an Amazon API Gateway REST API. The developer must ensure the API Gateway URL remains unchanged while testing the new version.
Which solution meets these requirements?
Create a new Lambda function version for the updated code. Configure API Gateway to use the new version. Deploy a new API Gateway stage with 10% traffic routing. Update the production stage to reference the new Lambda version.
Publish the updated Lambda function code to the $LATEST version. Create an alias pointing to $LATEST. Update the API Gateway integration to use the alias. Deploy the API Gateway to the existing production stage with 10% traffic allocation.
Publish a new version of the Lambda function. Create an alias for the production environment pointing to the original version. Configure a canary deployment in the API Gateway production stage, routing 10% of traffic to the new Lambda version via the alias. Update the alias to the new version after testing.
Deploy the updated Lambda function code as a new function. Create a new API Gateway resource linked to the new function. Use weighted routing in API Gateway to direct 10% of traffic to the new resource. Merge the resources after testing.
Explanation
Option C is correct because it leverages API Gateway's canary deployment feature to route a percentage of traffic to the new Lambda version without changing the API URL. Here's why:
1. Alias Management: The alias points to the original Lambda version initially, ensuring stability. After testing, updating the alias shifts all traffic to the new version.
2. Canary Deployment: API Gateway's canary deployment allows splitting traffic (10% in this case) to a new Lambda version while keeping the same API endpoint.
3. Unchanged URL: The solution avoids creating new stages or resources, ensuring the API Gateway URL remains consistent.
Other options fail because:
- A: Creates a new API Gateway stage, which changes the URL.
- B: Modifies $LATEST directly (risky) and lacks traffic-splitting via canary.
- D: Requires new API resources, altering the URL.
Key Points: Use API Gateway canary deployments with Lambda aliases for controlled traffic shifting without URL changes.
Answer
The correct answer is: C