How to configure traffic shifting between Lambda versions?
Short answer
AD Publish a version of the original Lambda function. Make the necessary changes to the Lambda code. Publish a new version of the Lambda function. Create an alias that points to the original version of the Lambda function. Configure the alias to be a weighted alias that also includes the new version of the Lambda function. Divide traffic between the two versions.
Question
Key Takeaways
The exam tests the specific workflow of publishing versions to enable immutability, followed by configuring an alias with routing weights to split traffic.
To test updates by dividing traffic, developers must publish versions of the Lambda function and use a weighted alias. This method allows for canary releases by routing a percentage of requests to the new version.
Common mistake: Selecting Option B is a frequent error, as users mistakenly attribute traffic routing capabilities to CodeBuild instead of Lambda aliases or CodeDeploy.
Expert Analysis
Why the Answer Is Correct
Option A is correct because traffic shifting requires immutable versions; you must publish the current state as a version before making changes, then publish the new code as a second version. Option D is correct because AWS Lambda aliases support routing configuration, allowing you to assign a percentage of traffic to a secondary version while the primary version handles the rest. Together, these steps create a standard canary release strategy.
Why the Other Options Are Wrong
Option B is incorrect because AWS CodeBuild is a build service for compiling and testing code, not a service for managing runtime traffic routing between Lambda versions. Option C is incorrect because adding function URLs creates separate endpoints rather than a single entry point that splits traffic internally. Option E is incorrect because Lambda aliases point to function versions ($LATEST or numbered versions), not to function URLs.
Community Comment Notes
The community consensus strongly supports AD, with users explicitly referencing the AWS CLI command update-alias and the --routing-config parameter. Comments confirm that the weighted alias configuration is the specific mechanism required to meet the requirement of dividing traffic between the two published versions.
Official Reference
- https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html
- https://docs.aws.amazon.com/lambda/latest/dg/invocation-versions.html
These links open the official vendor documentation in a new tab.
Exam Strategy
Remember the sequence for Lambda traffic shifting: first publish versions to create immutable snapshots, then create or update an alias with routing configuration to distribute the traffic percentages.
Community Votes
100% of anonymous learners picked answer AD. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 3 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 3
-
KennethNg923 👍 2A. Publish a version of the original Lambda function. Make the necessary changes to the Lambda code. Publish a new version of the Lambda function. D. Create an alias that points to the original version of the Lambda function. Configure the alias to be a weighted alias that also includes the new version of the Lambda function. Divide traffic between the two versions.
-
albert_kuo 👍 1aws lambda update-alias --function-name myFunction --name myAlias --routing-config '{"AdditionalVersionWeights": {"2": 0.1}}'
-
piipo 👍 1AD is best
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All DVA-C02 Questions
Access 100 questions with complete answers and detailed explanations.
View Full DVA-C02 Practice Test →