I am trying to install a simple stack using AWS CloudFormation. I create an IAM user and also pass in some script to install Puppet and Git through userdata so that it can be executed by cloudinit.
The problem is for some reason the template fails mid way and the stack creation is rolled back. I am doing this through the management GUI. But it doesn't tell me why it fails. I can see that some of the resources are created and then it fails. Is there a way to look at detailed logs to see what exactly is failing?
You can view logs, such as /var/log/cloud-init. log or /var/log/cfn-init. log , to help you debug the instance launch. You can retrieve the logs by logging in to your instance, but you must disable rollback on failure or else AWS CloudFormation deletes the instance after your stack fails to create.
If stack creation fails, go to the CloudFormation Resources list in the AWS Management Console to find the log group. Note that if stack creation fails before any instances are launched, a log group might not be created. By default, AWS deletes CloudWatch log groups if stack creation fails.
CloudFormation will continue to provision the resources until completion or stop on a different failure. Remediate any issues to continue the deployment process. CloudFormation performs the necessary updates before retrying provisioning actions on resources that couldn't be successfully provisioned earlier.
To view event logs for the stack, right-click the stack's name. The AWS Toolkit for JetBrains displays the event logs in the CloudFormation tool window.
The AWS Management Console for AWS CloudFormation offers an Events tab in the stack detail panel, which lists the stack life-cycle events and features a Reason column in turn, which contains more details for the errors in case.
This column exposes the ResourceStatusReason
field of the StackEvent data type retrieved via the DescribeStackEvents action:
ResourceStatusReason - Success/failure message associated with the resource
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With