Amazon API Gateway canary deployment

API Gateway REST API → AWS Lambda

Create a serverless app using API Gateway and Lambda. Then create an API Gateway canary deployment

This pattern shows how to create an API Gateway canary deployment with a Lambda function behind an API Gateway REST API. Once the canary deployment is live, requests will be routed to the new and old version of the Lambda function at a rate of 50/50 using the Lambda alias from the APIGW stage variables to route traffic to the correct version.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/apigw-canary-deployment-cdk-java

Deploy

cdk deploy MyServerlessApplicationStackcdk deploy MyServerlessApplicationStack -c env=dev cdk deploy CanaryDeploymentStack


Testing

See the GitHub repo for testing instructions.

Cleanup

1. Delete the Canary Deployment stack:
cdk destroy CanaryDeploymentStack
2. Delete the Serverless application stack.
cdk destroy MyServerlessApplicationStack

Created by:

Muhammed Soyer

Muhammed Soyer

I am a Technical Account Manager at AWS with a background of software development.

Follow on LinkedIn