Question 1 · choose 2
An AWS CloudFormation stack, deployed in four AWS Regions, runs a web tier on Amazon EC2 instances behind an Application Load Balancer. Engineers edit a Mappings section of per-Region AMI IDs whenever AWS publishes a new Amazon Linux 2023 AMI, and every stack update must now use the latest such AMI with no edits to the template. A recent update also completed successfully but raised the load balancer's 5xx error rate, and nobody noticed for an hour. CloudFormation must roll back an update by itself if the existing 5xx alarm goes into ALARM during the update or in the 15 minutes after all resources are deployed. Which actions should the DevOps engineer take? (Choose TWO.)
- AAdd the 5xx alarm as a rollback trigger in the stack's rollback configuration, with a monitoring time of 15 minutes
- BRun each update with the option to preserve successfully provisioned resources, so that a failed update keeps the healthy resources
- CKeep the Mappings section and have a scheduled Lambda function rewrite the AMI IDs in the template whenever a new AMI is published
- DDeclare the AMI as a parameter of type AWS::SSM::Parameter::Value<AWS::EC2::Image::Id> that defaults to the public Amazon Linux 2023 AMI parameter
- ESet the stack's monitoring time to 15 minutes in the rollback configuration, with no rollback triggers
Show the answer and why
AAdd the 5xx alarm as a rollback trigger in the stack's rollback configuration, with a monitoring time of 15 minutes
Correct
CloudFormation watches rollback triggers during the update and for the monitoring time after all resources are deployed, and rolls back the whole operation if an alarm goes into ALARM.
BRun each update with the option to preserve successfully provisioned resources, so that a failed update keeps the healthy resources
Incorrect
This option changes what happens when a resource fails to provision. It does not watch an alarm, so an update that succeeds is never rolled back.
CKeep the Mappings section and have a scheduled Lambda function rewrite the AMI IDs in the template whenever a new AMI is published
Incorrect
Mappings hold fixed values inside the template, so each new AMI still means a template change, now made by code the team must maintain.
DDeclare the AMI as a parameter of type AWS::SSM::Parameter::Value<AWS::EC2::Image::Id> that defaults to the public Amazon Linux 2023 AMI parameter
Correct
CloudFormation reads the latest value from Parameter Store when a stack is created or updated, and the public parameter in each Region holds that Region's latest AMI ID.
ESet the stack's monitoring time to 15 minutes in the rollback configuration, with no rollback triggers
Incorrect
Without rollback triggers, CloudFormation only waits for the monitoring time before it cleans up old resources. It watches no alarm and rolls nothing back on its own.
Two separate gaps need two separate features. A Systems Manager parameter type makes the template resolve the AMI ID from Parameter Store at each create or update, and the public Amazon Linux parameters always point at the latest image in their Region. Rollback triggers make the alarm part of the stack operation, and the monitoring time extends that watch past the moment the last resource is deployed.
AWS documentation
- Roll back your CloudFormation stack on alarm breach with rollback triggers (opens in a new tab)
- Choose how to handle failures when provisioning resources (opens in a new tab)
- Specify existing resources at runtime with CloudFormation-supplied parameter types (opens in a new tab)
- CloudFormation template Mappings syntax (opens in a new tab)
- Calling AMI public parameters in Parameter Store (opens in a new tab)