A developer is configuring a CI/CD pipeline to deploy updates to an AWS Lambda function that is integrated with an Amazon API Gateway REST API. The developer needs to implement a deployment strategy that routes of the incoming API traffic to the new Lambda version for a -minute evaluation period. If any errors are detected during this period, the traffic must automatically and immediately roll back to the stable version. The deployment must not require changes to the API Gateway stage configuration.
Which two configurations should the developer implement to meet these requirements?
- Configure the API Gateway integration to target a Lambda function alias instead of a specific version ARN or the qualifier.Answer
- Configure an AWS CodeDeploy deployment group to use the deployment configuration named `CodeDeployDefault.LambdaCanary10Percent20Minutes` and associate it with a CloudWatch alarm monitoring API Gateway errors.Answer
- CConfigure API Gateway stage canary settings, setting the canary traffic percentage to and mapping the canary to the new Lambda version ARN.
- DSet the deployment configuration in AWS CodeDeploy to `CodeDeployDefault.LambdaLinear10PercentEvery2Minutes` and associate the deployment group with a CloudWatch alarm monitoring API Gateway errors.
- EPublish the new Lambda version and update the API Gateway integration to point to the new version's ARN directly, relying on Lambda's built-in routing rules to shift of the traffic.
Answer
To meet the requirements, the developer must configure the API Gateway integration to target a Lambda function alias instead of a specific version ARN or the qualifier, and configure an AWS CodeDeploy deployment group to use the deployment configuration named `CodeDeployDefault.LambdaCanary10Percent20Minutes` and associate it with a CloudWatch alarm monitoring API Gateway errors.
Targeting a Lambda function alias from API Gateway allows AWS CodeDeploy to shift traffic at the Lambda level by shifting the alias routing configuration between two versions. Selecting the `CodeDeployDefault.LambdaCanary10Percent20Minutes` deployment configuration routes exactly of traffic to the new version for a -minute window while monitoring the associated CloudWatch alarms. If the alarm for errors fires, CodeDeploy automatically rolls back the alias configuration to route all traffic back to the stable version, achieving an automated rollback.
Step-by-Step Solution
Key Concept
Lambda Canary Deployments with AWS CodeDeploy
Estimated Time:2m 0s