AWS Lambda Supports Traffic Shifting and AWS CodeDeploy Deployments

Posted on: Nov 28, 2017

You can now shift incoming traffic between two AWS Lambda function versions based on pre-assigned weights. This allows you to gradually shift traffic between two versions, helping you reduce the risk and limit the blast radius of new Lambda deployments. You can now also use AWS CodeDeploy to automatically manage the rollout of new function versions. CodeDeploy is a service that automates software deployments to a variety of compute services like Lambda and Amazon EC2. CodeDeploy makes it easy to gradually and safely deploy updates to Lambda, and it is supported by the AWS Serverless Application Model.  

Previously, when you pointed a Lambda function alias to a new function version, all traffic would be routed to the new version immediately. Now, you can point a Lambda alias to two function versions and configure the percentage of traffic that is routed to each version. You can set traffic shifting using the AWS Management Console, AWS CLI, and SDKs. This feature is available in all regions that support Lambda.

AWS CodeDeploy leverages Lambda’s traffic shifting capabilities to automate the gradual rollout of new function versions. It can also help you use deployment best practices, such as testing a new change on a small portion of traffic before deploying it to all customers. For example, CodeDeploy lets you automate pre-deployment tests that a function must pass before it begins taking traffic. You can also set alarms that automatically trigger rollbacks in the event of errors. You can easily build these deployment patterns into your release process by defining CodeDeploy within your Serverless Application Model templates. Finally, using SAM with a CI/CD service like AWS CodePipeline lets you automate the entire process of building, testing, and rolling out new versions. CodeDeploy can also be used with the AWS Management Console, AWS CLI, and SDKs.

CodeDeploy’s Lambda deployment feature is available in US East (N. Virginia) and South America (São Paulo). It will be available in these regions later this week: US East (Ohio), US West (Oregon), US West (N. California), Canada (Central), EU (Ireland), EU (Frankfurt), EU (London), Asia Pacific (Singapore), Asia Pacific (Tokyo), Asia Pacific (Sydney), Asia Pacific (Seoul), and Asia Pacific (Mumbai) regions.

Visit the Lambda documentation to learn more.