How to configure traffic shifting between Lambda versions?

A developer uses an AWS Lambda function in an application to edit users' uploaded photos. The developer needs to update the Lambda function code and needs to test the updates. For testing, the developer must divide the user traffic between the original version of the Lambda function and the new version of the Lambda function. Which combination of steps will meet these requirements? (Choose two.)

  1. Publish a version of the original Lambda function. Make the necessary changes to the Lambda code. Publish a new version of the Lambda function. Source Reference Answer
  2. Use AWS CodeBuild to detect updates to the Lambda function. Configure CodeBuild to incrementally shift traffic from the original version of the Lambda function to the new version of the Lambda function.
  3. Update the original version of the Lambda function to add a function URL. Make the necessary changes to the Lambda code. Publish another function URL for the updated Lambda code.
  4. 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. Source Reference Answer
  5. Create an alias that points to the original function URL. Configure the alias to be a weighted alias that also includes the additional function URL. Divide traffic between the two function URLs.

Community Votes

AD
100%

100% of anonymous learners picked answer AD. Votes are pick records left by other test-takers — they are not the verified answer.

Community Insight

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.

Selecting Option B is a frequent error, as users mistakenly attribute traffic routing capabilities to CodeBuild instead of Lambda aliases or CodeDeploy.

Community Discussion (3 comments)

albert_kuo 👍 1 Selected: AD
aws lambda update-alias --function-name myFunction --name myAlias --routing-config '{"AdditionalVersionWeights": {"2": 0.1}}'
KennethNg923 👍 2 Selected: AD
A. 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.
piipo 👍 1 Selected: AD
AD is best

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

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

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.

Related Analysis

Practice All DVA-C02 Questions

Access 100 questions with complete answers and detailed explanations.

View Full DVA-C02 Practice Test →

← Back to DVA-C02 Study Guide