Question

Difficulty: HardDeployment Strategies

A developer is configuring a deployment pipeline using AWS CodeDeploy to update an AWS Lambda function. The deployment uses the `CodeDeployDefault.LambdaCanary10Percent10Minutes` configuration, which shifts 10%10\% of the traffic to the new version for a duration of 10 minutes10\text{ minutes}. The traffic is routed through a Lambda alias named `live`. The developer wants to ensure the deployment automatically rolls back if the new function version introduces errors, while preventing false rollbacks caused by test executions on the `$LATEST` version or activity on other development aliases of the function. Which configuration should the developer implement to meet these requirements?

  1. Create a CloudWatch Alarm for the Lambda `Errors` metric using the `FunctionName` and `Resource` dimensions, with the `Resource` dimension set to `my-function:live`. Associate this alarm with the CodeDeploy deployment group's rollback configuration.Answer
  2. B
    Create a CloudWatch Alarm for the Lambda `Errors` metric using only the `FunctionName` dimension. Associate this alarm with the CodeDeploy deployment group's rollback configuration.
  3. C
    Create a CloudWatch Alarm for the Lambda `Errors` metric using the `Resource` dimension set to `my-function:$LATEST`. Associate this alarm with the CodeDeploy deployment group's rollback configuration.
  4. D
    Create a CloudWatch Alarm for the Lambda `Errors` metric using a dynamic `Resource` dimension set to the newly created version number. Use a CodeDeploy `BeforeAllowTraffic` lifecycle hook to update the deployment group with this alarm before traffic shifting starts.

Answer

Create a CloudWatch Alarm for the Lambda Errors metric using the FunctionName and Resource dimensions, with the Resource dimension set to the function name and the live alias. Associate this alarm with the CodeDeploy deployment group's rollback configuration.
The correct answer configuration monitors the specific Lambda alias (live) that is undergoing traffic shifting. Lambda publishes metrics under the Resource dimension in the format of FunctionName:AliasName. Monitoring this specific resource isolates the traffic routed to the production environment, ensuring that errors on other versions or aliases do not cause false alarms, and that any issues introduced by the new canary version are correctly detected.

Step-by-Step Solution

1
Identify how Lambda metrics are published to CloudWatch.
Recall that Lambda emits metrics with dimensions FunctionName (aggregating all traffic) and Resource (tracking a specific version or alias, formatted as FunctionName:Alias or FunctionName:Version).
To monitor the specific deployment's health, we need to know how to filter the metrics.
2
Evaluate which dimension isolates the deployment traffic.
The alias live is being updated by CodeDeploy. Thus, monitoring the Resource dimension with my-function:live isolates all traffic routed to the alias during the deployment, capturing errors from both the new and old versions.
This allows the alarm to trigger a rollback if the new version introduces errors, without being affected by testing on other aliases or $LATEST.
3
Assess the distractors against the requirements.
Distractors using only FunctionName monitor other environments. Distractors using $LATEST miss the canary traffic. Dynamic version monitoring is not supported.
To confirm that the chosen configuration is the only viable option.

Key Concept

AWS CodeDeploy automates Lambda traffic shifting using aliases. Monitoring for automatic rollbacks must use the specific alias Resource dimension to isolate deployment-related errors and avoid false rollbacks from unrelated invocations.
Estimated Time:2m 0s
Rate this question