AWS CloudFormation Fundamentals: CloudFormation Updates and Deletes

Опубликовано: 21 Июнь 2026
на канале: Tech Guides and Thoughts
880
14

Get my complete CloudFormation AND Terraform course. After all...why not both? ¯\_(ツ)_/¯ https://awsdevops.io/p/infrastructure...

Before we dive into templates and their structure, we first need to discuss how CloudFormation goes about changing resources. There are some gotchas that are a must-know so you don't accidentally, say, delete something you didn't intend to. We'll use the EC2 Resource page in the documentation for our example, which I've linked to below.

Now, there is the possibility that when you go to update something in your template, it might not be just replaced like you expected but deleted entirely. This is because CloudFormation has three possibilities when it comes to updating the properties on a resource: (1) No interruption, (2) Some interruptions, or (3) Replacement, aka deletion. (I'll link to the Update Behavior documentation below so you can read the explanations for each of these options for yourself.) You could just guess on which of these three will occur but there's a MUCH easier way to figure out what's going to happen when you update a property on a resource you've defined in your template: checking the 'Updates requires'!

This can be found in the properties section of resources in the AWS documentation and it will list which of the three will happen when you update. It's not always listed but often it is, like in our example with EC2 here. It's a much better alternative than just waiting to see what CloudFormation gives you in the change set when you go to update. So the workflow here is very simple: when you want to update a resource in your template, just check its 'Updates required' property. This way you know exactly what's going to happen.

So what happens when an update fails? Well, AWS is pretty great here in that it'll just roll your infrastructure back to its previous state. And what about when you want to delete a stack entirely? How difficult is that? It's not. Since all of the template's resources are bound together according to CloudFormation (thanks to metadata when you created it), when you delete a stack it's totally deleted then and there because it'll clean up all of those related resources.

I know this seems like a TON of information, and we haven't even put something together yet. But don't worry! Once we dive into setting up our project and working with it, you'll see how all this information comes together in action.

Below I've included links to the documentation we look through during this video:

1. AWS CloudFormation EC2 Resource - https://docs.aws.amazon.com/AWSCloudF...

2. AWS CloudFormation Update Behavior - https://docs.aws.amazon.com/AWSCloudF...