Closed jonathandietz closed 9 years ago
A note on this is that the ec2 instance must signal cloud-formation that it has completed it's setup. In the past, I used cfn-signal: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-signal.html
cfn-signal would be executed by a userdata script provided to cloud-init.
I don't think this is actually an issue. At times, the initial setup phase fails the first time you set it up. I don't know why. It almost always works perfectly the second time
I tried it it multiple regions and it would fail, and rollback. I would repeat and it would fail and rollback again. Disabling the rollback I could see that some of the opsworks servers were taking a long time to boot and complete the setup step. I ended up leaving the existing failed cloudformation run in place, without deleting it, and creating a new one using the same template.
This was what finally worked for me.
The CloudFormation setup fails at the EC2 instance creation. When looking at OpsWorks the instances are still running the setup phase of the chef run and then eventually get setup fine, with no errors.
There should probably be a wait condition added to the CloudFormation json that waits for the EC2 instances to finish being setup before failing the CloudFormation run.
WaitCondition: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-waitcondition.html
CreationPolicy Attribute: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-creationpolicy.html