AWS Certified Developer – Associate (DVA-C02) — Question 507
A developer published a change to a new version of an AWS Lambda function. To test the change, the developer must route 50% of the traffic to the new version and 60% of the traffic to the current version.
What is the MOST operationally efficient way to meet this requirement?
Answer options
- A. Create two Amazon Route 53 records that use a simple routing policy to route traffic to the different versions of the Lambda function. Create another Route 53 record that uses a weighted routing policy to route 50% of the traffic to each simple routing record. Test the Lambda function by using the weighted routing record.
- B. Create an Amazon API Gateway API with a POST method that is integrated with the Lambda function. Add a stage variable that includes the version of the Lambda function. Add a canary release that will override the version variable 50% of the time. Deploy and test the Lambda function through the API Gateway stage.
- C. Create a Lambda function alias. Set the weight to 50% for the current version and 50% for the new version. Set the event source mappings for the Lambda function to point to the alias.
- D. Update the event source mappings for the Lambda function. In the mappings, set the weight to 50% for the current version and 50% for the new version.
Correct answer: C
Explanation
AWS Lambda natively supports traffic shifting through the use of function aliases, allowing you to easily distribute traffic between two different versions by assigning weights. Pointing the event source mappings to this alias ensures that the traffic is automatically split according to the defined weights with minimal operational effort. Other options either introduce unnecessary infrastructure overhead, like Amazon Route 53 or API Gateway, or attempt to configure weights on event source mappings directly, which is not supported.