An enterprise is deploying a new version of a stateless Java-based web application to Amazon EC2 instances within an Auto Scaling group. The infrastructure is managed using AWS CloudFormation. The deployment strategy requires zero downtime, guarantees that new EC2 instances are fully booted and verified as healthy before older instances are terminated, and automatically rolls back to the previous stable version if the deployment fails.
Which two configurations should a solutions architect implement to meet these requirements? (Select two.)
- Configure an UpdatePolicy with the AutoScalingRollingUpdate attribute on the AWS::AutoScaling::AutoScalingGroup resource, setting both MinInstancesInService to a value greater than zero and WaitOnResourceSignals to true.Cevap
- Include the cfn-signal helper script in the EC2 instance UserData, configured to signal success to the CloudFormation stack only after the application process is fully running and has passed local health checks.Cevap
- CConfigure an UpdatePolicy with the AutoScalingReplacingUpdate attribute on the AWS::AutoScaling::AutoScalingGroup resource, and rely on the Application Load Balancer target group health check to automatically signal completion.
- DDefine a CloudFormation parameter to trigger a rolling update of the Launch Template, setting the PauseTime to zero to allow the Application Load Balancer to immediately shift traffic using connection draining.
- EDeploy a second duplicate Auto Scaling group for the new launch template version, configure Route 53 weighted records to split traffic, and configure a CloudWatch alarm to trigger stack deletion on failure.
Cevap
To meet the requirements, the solutions architect should configure the CloudFormation template to use the AutoScalingRollingUpdate update policy on the Auto Scaling group with WaitOnResourceSignals set to true, and use the cfn-signal helper script in the EC2 instance UserData to signal success after the application has fully initialized and passed health checks.
To achieve zero downtime and automatic rollbacks during a CloudFormation-managed Auto Scaling group update, the solutions architect must configure the AutoScalingRollingUpdate policy with WaitOnResourceSignals set to true. This forces CloudFormation to wait for a predefined number of success signals before moving to the next batch of instances. To generate these signals, the cfn-signal helper script must be executed within the EC2 instance's UserData after the application successfully starts and passes local verification. If the instances fail to signal within the PauseTime period, CloudFormation aborts the deployment and rolls back to the previous launch template version.
Adım Adım Çözüm
Anahtar Kavram
AWS CloudFormation AutoScalingRollingUpdate deployment strategy with resource signaling