I manually deleted a resource that was created by one of my AWS CloudFormation stacks, and now my stack won't update.
Short description
If you delete a resource that was created by a CloudFormation stack, then your stack fails to update, and you get an error message.
Choose one of the following resolutions based on your resource type:
- Update a resource with a unique name
- Update a resource with a unique ID
Resolution
Update a resource with a unique name
If the deleted resource supports a unique name, then you can manually create the resource to update the stack. Note that the new resource must have the same name as the deleted resource. If you try to use a different name, then CloudFormation might not handle that resource the way that you expect because AWS Identity and Access Management (IAM) roles are tracked by name. If you accidentally delete an IAM role, manually recreate that role with the same name.
To update an IAM role or any other resource with a unique name, complete the following steps:
- Open the AWS CloudFormation console.
- Select your stack, and then choose the Resources view.
- In the Physical ID column, find the Physical ID of the IAM role that you want to replace with your new IAM role.
Note: The Physical ID is the name of the resource.
- Create a new IAM role, and then give the new role the same Physical ID that you found in step 3.
- Update your stack.
Note: For more information, see Update your stack template.
Update a resource with a unique ID
You can't manually recreate a resource, such as a route table, with a unique ID. For more information on how to create this resource, see How do I recreate a resource that was deleted outside of CloudFormation?
Related information
Troubleshooting CloudFormation