AWS Certified Developer – Associate / Question #1068 of 557

Question #1068

A company is developing a file processing service. A developer is updating an AWS Lambda function that handles user-uploaded files. The backend service uses the AWS SDK to invoke this Lambda function. After testing the updated code, the developer wants to deploy it such that only a fraction of the invocations use the new version.

Which solution will meet these requirements?

A

Publish a new Lambda version and assign a weighted routing policy directly to the version.

B

Create an alias for the Lambda function and configure a weighted routing policy for the updated version.

C

Deploy an Application Load Balancer with weighted target groups pointing to the original and updated Lambda functions.

D

Use a Network Load Balancer with weighted target groups to route traffic between the original and updated Lambda functions.

Explanation

Answer B is correct because AWS Lambda aliases support weighted routing configurations, which allow developers to direct a specified percentage of invocations to different versions of the function. This enables gradual rollouts (e.g., 10% to the new version, 90% to the old version).

Why other options are incorrect:
- A: Lambda versions are immutable and cannot have routing policies assigned directly. Aliases are required to manage traffic routing.
- C/D: Application/Network Load Balancers are not designed for routing Lambda invocations. While ALBs can invoke Lambda via target groups, this approach adds unnecessary complexity compared to native alias-based routing. NLBs are for low-level TCP/UDP traffic and do not integrate with Lambda for this use case.

Key Points:
1. Use Lambda aliases to manage traffic splitting between versions.
2. Weighted routing via aliases is the simplest and most efficient method for gradual deployments.
3. Avoid overcomplicating with load balancers unless required for specific use cases (e.g., HTTP request handling).

Answer

The correct answer is: B