I have manually deleted a resource that was created by one of my AWS CloudFormation stacks. When I try to update the stack, it fails because of this missing resource. I want to resolve this issue without deleting and re-create the entire CloudFormation stack.

Resources that are created as part of an AWS CloudFormation stack must be managed from the same stack. Modifications to a resource must be done by a stack update. If a resource is deleted, a stack update is also necessary to remove the resource from the template. If a resource has been accidentally or purposely manually deleted, you can encounter errors when attempting to perform a stack update.

You might be able to re-create a resource that is created manually by name. For example, IAM roles are tracked by name. If you accidentally delete an IAM role, you can manually re-create it with the exact same name and attempt to update your stack again. To find the name that CloudFormation uses for the IAM role, from the CloudFormation console choose the Resources tab and then select the Physical ID.

A resource with a unique ID cannot be manually re-created. For example, a route table resource AWS::EC2::RouteTable has a unique route table ID that cannot be manually changed, such as rtb-12a3456. In order to have CloudFormation re-create your route table, you must remove it and any reference to it from your template and then perform a stack update. For more information, see Modifying a Stack Template. If the update is successful, you must perform a subsequent update with the route table resource and any other removed resources or references added back to the template. CloudFormation then re-creates the deleted resource.

If a resource was deleted because you no longer need it and you want to remove it from the stack, remove the resource and any references to it from your template, and then perform a stack update.

CloudFormation, deleted, manually, manually deleted

Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center

Published: 2016-09-22