Step 1: Understanding the Requirements
Gradual Traffic Shift: Test the new version by routing only 10% of production traffic to it.
Lambda Deployment: Use versioning and aliases to manage Lambda function updates.
Step 2: Solution Analysis
Option A:
Publishing a new version creates an immutable version of the Lambda function with the updated code.
This is a prerequisite for deploying changes using weighted aliases.
Correct option.
Option B:
API Gateway stages are not used for weighted routing; they represent environments like "dev" or "prod."
Weighted routing is implemented using Lambda aliases, not API Gateway stages.
Not suitable.
Option C:
Lambda aliases allow traffic to be split between versions using weighted routing.
Assign a 90% weight to the old version and 10% to the new version to implement the gradual rollout.
Correct option.
Option D:
Network Load Balancers are not suitable for managing Lambda function traffic directly.
Not applicable.
Option E:
Route 53 routing policies apply at the DNS level and are not designed for Lambda version management.
Not suitable.
Step 3: Implementation Steps
Publish a New Version:
Publish the updated Lambda function code as a new version.
Create an Alias and Configure Weighted Routing:
Create an alias (e.g., prod) and associate it with both the old and new versions.
Set weights for traffic distribution:
aws lambda update-alias --function-name my-function \
--name prod --routing-config '{"AdditionalVersionWeights": {"2": 0.1}}'
AWS Developer References:
Lambda Function Aliases
Weighted Traffic Routing with Lambda