A healthcare company runs a compliant web service on Amazon EC2 instances inside an Auto Scaling Group (ASG) behind an Application Load Balancer (ALB). The instances must apply specific configuration baselines via an AWS Systems Manager (SSM) State Manager association before serving production traffic. During rapid scale-out events, instances are registered with the ALB target group and begin receiving client traffic before the SSM State Manager association has completed execution, resulting in intermittent compliance auditing failures. A solutions architect must design a fully automated remediation strategy that prevents instances from serving traffic until they are compliant, while minimizing operational overhead. Which strategy should the solutions architect implement?
- AModify the AWS CloudFormation template that manages the Auto Scaling group to include a CreationPolicy, and configure the EC2 user data script to run the cfn-signal helper script after the Systems Manager State Manager association finishes executing.
- Create a launch lifecycle hook in the Auto Scaling group. Configure an Amazon EventBridge rule that detects the lifecycle transition and triggers an AWS Systems Manager Automation workbook. The workbook executes the State Manager association on the target instance and completes the lifecycle action with a CONTINUE status upon successful execution.Answer
- CIncrease the default cooldown period of the Auto Scaling group and adjust the Application Load Balancer health check interval to be longer than the maximum expected runtime of the State Manager association.
- DConfigure the Application Load Balancer target group to perform a blue/green canary deployment for every scaling event, routing a small percentage of traffic to the new instance while a cron script on the instance polls the local SSM Agent status.