AWS SAM and CodeDeploy: Shifting Traffic to New Lambda Function Quickly

Shift Traffic to New Lambda Function Quickly

Prev Question Next Question

Question

You are using AWS SAM to define a Lambda function and configure CodeDeploy to manage deployment patterns.

With the new Lambda function working as per expectation which of the following will shift traffic from the original Lambda function to the new Lambda function in the shortest time frame?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Correct Answer - A.

With the Canary Deployment Preference type, Traffic is shifted in two intervals.

With Canary10Percent5Minutes, 10 percent of traffic is shifted in the first interval while remaining all traffic is shifted after 5 minutes.

Option B is incorrect as Linear10PercentEvery10Minutes will add 10 percent traffic linearly to a new version every 10 minutes.

So, after 100 minutes all traffic will be shifted to the new version.

Option C is incorrect as Canary10Percent15Minutes will send 10 percent traffic to the new version and 15 minutes later complete deployment by sending all traffic to the new version.

Option D is incorrect as Linear10PercentEvery5Minute will add 10 percent traffic linearly to the new version every 5 minutes.

So, after 50 minutes all traffic will be shifted to the new version.

For more information on Deployment Preference Type for AWS SAM templates, refer to the following URL-

https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/automating-updates-to-serverless-apps.html

AWS SAM (Serverless Application Model) is a framework for building serverless applications using AWS Lambda. CodeDeploy is a service provided by AWS to automate code deployments to any instance, including EC2 instances and Lambda functions. In this scenario, AWS SAM is being used to define a Lambda function, and CodeDeploy is being configured to manage deployment patterns.

When a new version of a Lambda function is deployed using CodeDeploy, there are two types of deployment patterns available: canary and linear.

  • Canary: This pattern allows you to deploy a new version of the Lambda function to a small subset of users or traffic. This subset is called a canary group. Once the new version has been deployed to the canary group, CodeDeploy monitors the group for errors or other issues. If there are no issues, CodeDeploy gradually increases the traffic to the new version until it is handling all traffic. If there are issues, CodeDeploy rolls back the deployment to the previous version.

  • Linear: This pattern allows you to deploy a new version of the Lambda function to a small percentage of traffic at a time. You can specify the percentage of traffic that should be shifted to the new version in each step, as well as the time interval between each step. This deployment pattern is useful for gradually transitioning traffic to the new version while monitoring for errors or other issues.

In this scenario, the question is asking which deployment pattern will shift traffic from the original Lambda function to the new Lambda function in the shortest time frame. Of the options provided, the canary pattern with a 10% traffic shift and 5-minute monitoring interval (Option A) will shift traffic to the new Lambda function in the shortest time frame. This is because it starts with a smaller subset of traffic and has a shorter monitoring interval, allowing for a quicker transition to the new version if there are no issues.

Option B (linear pattern with 10% traffic shift every 10 minutes) and Option D (linear pattern with 10% traffic shift every 5 minutes) will take longer to shift traffic to the new Lambda function because they start with a larger percentage of traffic and have longer intervals between each shift.

Option C (canary pattern with 10% traffic shift and 15-minute monitoring interval) will also take longer to shift traffic to the new Lambda function because it has a longer monitoring interval.

Therefore, the correct answer is A. Canary10Percent5Minutes.