Update configuration

Deployment Preference Types

For this time, we will the Canary10Percent5Minutes strategy, which means that traffic is shifted in two increments. In the first increment, only 10% of the traffic is shifted to the new Lambda version, and after 5 minutes, the remaining 90% is shifted. There are other deployment strategies you can choose in CodeDeploy:

  • Canary10Percent30Minutes
  • Canary10Percent5Minutes
  • Canary10Percent10Minutes
  • Canary10Percent15Minutes
  • Linear10PercentEvery10Minutes
  • Linear10PercentEvery1Minute
  • Linear10PercentEvery2Minutes
  • Linear10PercentEvery3Minutes
  • AllAtOnce

Update main stack

Open the sls_app_stack.py in your project and update LambdaDeploymentGroup.deployment_config attribute to new value.

aws_codedeploy.LambdaDeploymentGroup(self,
    'DeploymentGroup',
    alias=alias,
    application=app,
    deployment_config=aws_codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE
)

to

aws_codedeploy.LambdaDeploymentGroup(self,
    'DeploymentGroup',
    alias=alias,
    application=app,
    deployment_config=aws_codedeploy.LambdaDeploymentConfig.CANARY_10_PERCENT_5_MINUTES
)

Commit code changes

Commit the changes to update our pipeline.

cd ~/environment/sls-app
git add .
git commit -m "Add Canary deployments"