A developer is managing a web application infrastructure deployed via an AWS CloudFormation stack. The stack includes an Auto Scaling group of Amazon EC2 instances, which are configured using AWS::CloudFormation::Init metadata and helper scripts to install packages and start the application. During a stack update, the update fails and rolls back because the new instances do not signal success to the stack within the specified timeout. Additionally, the developer suspects that team members might have made manual configuration changes directly on the production EC2 instances. Which two actions should the developer take to troubleshoot the deployment failure and address the configuration drift? (Choose two.)
- Run drift detection on the CloudFormation stack to identify any out-of-band modifications made to the stack resources.Answer
- Inspect the /var/log/cfn-init.log and /var/log/cloud-init-output.log files on the EC2 instances to determine why the helper scripts failed to execute or signal success.Answer
- CManually apply the configuration changes directly to the EC2 instances via the AWS Management Console to match the updated template before executing the stack update.
- DStore the database credentials in Systems Manager Parameter Store and configure built-in automatic rotation directly on the parameter.
- EEmbed IAM user credentials directly within the EC2 instances' UserData script to ensure cfn-signal has permission to authenticate with CloudFormation.
Answer
Running drift detection on the CloudFormation stack and inspecting the /var/log/cfn-init.log and /var/log/cloud-init-output.log files on the EC2 instances.
To troubleshoot a rolling deployment failure where the EC2 instances fail to signal success, the developer must inspect the helper script logs. The /var/log/cfn-init.log file captures the output and status of the cfn-init metadata execution, while /var/log/cloud-init-output.log captures the standard output and error of the user data script execution. Additionally, running drift detection is the standard way to identify out-of-band resource modifications without manual inspection or disrupting the stack.
Step-by-Step Solution
Key Concept
Troubleshooting CloudFormation helper scripts and managing stack drift.