An enterprise deploys its core e-commerce application on Amazon EC2 instances within an Auto Scaling group (ASG) using AWS CloudFormation. Recently, engineers manually modified several security groups associated with the ASG, leading to configuration drift and subsequent deployment failures during CloudFormation stack updates. Additionally, during a rapid scale-out event, the ASG launched multiple instances that were immediately added to the Application Load Balancer (ALB) target group before their local bootstrapping scripts finished installing required packages, resulting in transient HTTP 502 errors for clients. A Solutions Architect must design an automated solution to remediate the configuration drift and ensure newly launched instances do not receive traffic until bootstrapping completes successfully. Which two actions should the Solutions Architect take to meet these requirements? (Select TWO.)
- Configure an Auto Scaling group lifecycle hook for the EC2_INSTANCE_LAUNCHING transition. Modify the EC2 user data script to perform the bootstrapping tasks, and upon successful completion, execute the complete-lifecycle-action CLI command to transition the instance to the InService state.Answer
- Deploy the AWS Config managed rule cloudformation-stack-drift-detection-check to monitor the stack. Configure an Amazon EventBridge rule to detect non-compliant status events and trigger an AWS Systems Manager Automation runbook to remediate the drifted resources.Answer
- CIncrease the Auto Scaling group cooldown period and configure the Application Load Balancer health check grace period to exceed the maximum package installation time of the bootstrapping script.
- DAttach a Service Control Policy (SCP) at the Organization root that denies the cloudformation:UpdateStack API action to all users, forcing all updates to go through the central CI/CD pipeline.
- EConfigure a Systems Manager State Manager association to remediate drift by retrieving the golden configuration templates from a centralized Amazon S3 bucket, decrypting the templates using the default AWS-managed KMS key (aws/s3) shared across accounts.