A SysOps administrator is managing an AWS CloudFormation template that deploys a web application hosted on Amazon EC2 instances within an Auto Scaling group (ASG) behind an Application Load Balancer. The ASG has a desired capacity of instances. The administrator is preparing to deploy an application update by updating the Amazon Machine Image (AMI) reference in the ASG's Launch Template.
The deployment must satisfy the following operational requirements:
- The update must be zero-downtime and maintain at least the desired capacity of healthy instances in service throughout the entire update process.
- Each new instance must be verified as fully initialized and running the application successfully before any existing instance is terminated.
- If any new instance fails to initialize within a specified timeframe, the deployment must automatically roll back to the original Launch Template version without administrative intervention.
Which configuration should the administrator implement to meet these requirements?
- ASet the CloudFormation UpdatePolicy for the ASG to use AutoScalingReplacingUpdate. Configure WaitOnResourceSignals to false, and rely on the Application Load Balancer's target group health checks to automatically trigger a rollback of the CloudFormation stack if any new instance is marked unhealthy.
- BUse AWS Systems Manager Run Command to perform an in-place update of the application code on the existing EC2 instances. Configure an AWS Config rule to monitor the instance compliance status and trigger a rollback if any instance reports a non-compliant state.
- Set the CloudFormation UpdatePolicy for the ASG to use AutoScalingRollingUpdate. Configure MinInstancesInService to , MaxBatchSize to , and WaitOnResourceSignals to true. In the Launch Template UserData, execute the cfn-signal helper script after the application starts and passes health checks.Cevap
- DSet the CloudFormation UpdatePolicy for the ASG to use AutoScalingRollingUpdate. Configure MinInstancesInService to and WaitOnResourceSignals to true. Configure the EC2 instance profile to allow the instances to assume an IAM role with stack update permissions so they can update the CloudFormation stack status directly via the AWS CLI.