AWS Certified Developer – Associate (DVA-C02) — Question 509
A company is building a social media application. A developer is modifying an AWS Lambda function that updates a database with data that tracks each user's online activity. A web application server uses the AWS SDK to invoke the Lambda function.
The developer has tested the new Lambda code and is ready to deploy the code into production. However, the developer wants to allow only a small percentage of the invocations from the AWS SDK to call the new code.
Which solution will meet these requirements?
Answer options
- A. Configure a Lambda version that has a specific weight value for the updated Lambda function.
- B. Create an alias for the Lambda function. Configure a specific weight value for the updated version.
- C. Create an Application Load Balancer. Specify weighted target groups for the original Lambda function and the updated Lambda function.
- D. Create a Network Load Balancer. Specify weighted target groups for the original Lambda function and the updated Lambda function.
Correct answer: B
Explanation
AWS Lambda allows you to shift traffic between two function versions by configuring routing weights on a single Lambda alias. This enables the AWS SDK to continue calling the same alias while Lambda automatically distributes the invocations based on the specified percentage. Options involving load balancers (ALB and NLB) are incorrect because they introduce unnecessary architectural complexity and would require changing how the client invokes the function.