An enterprise is designing a deployment pipeline for a critical transaction-processing application. The application runs on Amazon EC2 instances managed by an Auto Scaling group (ASG) behind an Application Load Balancer (ALB). The infrastructure is defined and managed using AWS CloudFormation. The application processes long-running database transactions that can take up to minutes to complete; interrupting these transactions results in data corruption. The deployment strategy must meet the following requirements:
1. Roll out updates with zero downtime.
2. Ensure that instances are never terminated while processing active transactions.
3. Automatically roll back the CloudFormation stack to the previous version if new instances fail to initialize or fail application-level health checks.
4. Minimize additional compute costs by avoiding the pre-allocation of a duplicate Auto Scaling group during the deployment.
Which configuration strategy should the Solutions Architect implement to meet these requirements?
- Update the CloudFormation template to configure the ASG `UpdatePolicy` with `AutoScalingRollingUpdate`. Set `WaitOnResourceSignals` to `true` and define an appropriate `Timeout`. Configure an `EC2_INSTANCE_TERMINATING` lifecycle hook on the ASG that runs a script to wait for active connections to drain before completing the hook. In the EC2 user data, start the application, run a local health check script, and invoke the `cfn-signal` helper utility upon success.Cevap
- BUpdate the CloudFormation template to configure the ASG `UpdatePolicy` with `AutoScalingReplacingUpdate`. Rely on the ALB target group's default deregistration delay to drain connections. Configure the CloudFormation stack with a rollback trigger based on CloudWatch alarms monitoring the application's health.
- CConfigure AWS CodeDeploy to perform an In-Place deployment using a `CodeDeployDefault.AllAtOnce` configuration. Use a CodeDeploy `ApplicationStop` lifecycle hook to wait for active connections to drain. Configure CloudWatch alarms to trigger a CodeDeploy automatic rollback on deployment failure.
- DCreate a new AWS CloudFormation template that uses the `AWS::CodeDeploy::BlueGreen` hook to manage the EC2 Auto Scaling group deployment. Configure the deployment group to use a canary shifting strategy and monitor CloudWatch alarms to trigger an automatic rollback.