I'm experimenting with CloudFormation right now. I deployed a stack that included an AutoScalingGroup (and LaunchConfig and CloudFormation::Init), LoadBalancer, a single EC2 instance (and CloudFormation::Init), and a couple security groups.
If I terminate EC2 instances created by the AutoScalingGroup, they get recreated as expected. This is actually quite useful for testing changes to my LaunchConfiguration and CloudFormation::Init settings (basically making sure it works from scratch).
I also have an EC2 instance (named DnsServer1
) that has a public IP. While working on its CloudFormation::Init data, I also manually terminated its instance. I know CloudFormation doesn't restore it like an AutoScalingGroup does, but I was expecting it would be recreated when I ran aws cloudformation update-stack
.
Instead, I get the error: AWS::EC2::Instance DnsServer1 i-014eee8720c4fb542 does not exist
.
Full update log:
11:03:40 UTC-0500 UPDATE_ROLLBACK_COMPLETE AWS::CloudFormation::Stack GregCFTest1
11:03:38 UTC-0500 UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS AWS::CloudFormation::Stack GregCFTest1
11:03:36 UTC-0500 UPDATE_COMPLETE AWS::AutoScaling::LaunchConfiguration WebServerLaunchConfig
11:03:36 UTC-0500 UPDATE_COMPLETE AWS::EC2::Instance DnsServer1
11:03:13 UTC-0500 UPDATE_ROLLBACK_IN_PROGRESS AWS::CloudFormation::Stack GregCFTest1 The following resource(s) failed to update: [DnsServer1].
11:03:11 UTC-0500 UPDATE_COMPLETE AWS::AutoScaling::LaunchConfiguration WebServerLaunchConfig
11:03:10 UTC-0500 UPDATE_FAILED AWS::EC2::Instance DnsServer1 i-014eee8720c4fb542 does not exist
11:03:00 UTC-0500 UPDATE_IN_PROGRESS AWS::CloudFormation::Stack GregCFTest1 User Initiated
What can I do to get CloudFormation to recreate this resource, short of deleting the stack and recreating it?