Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find the root cause for AWS CloudFormation stack creation failure?

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?

like image 207
Silent User Avatar asked Dec 14 '12 11:12

Silent User


People also ask

Where can I find CloudFormation errors?

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.

What happens when CloudFormation stack creation fails?

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.

What is the default behavior of a CloudFormation stack if 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.

How do I view logs of CloudFormation stack?

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.


1 Answers

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

like image 199
Steffen Opel Avatar answered Oct 20 '22 22:10

Steffen Opel