Stack Updates and Change Sets
What You'll Learn
You'll learn how to safely modify your existing CloudFormation stacks and preview changes before they take effect.
Understanding Stack Updates
When your infrastructure needs change, you don't create a new stack from scratch—you update the existing one. Think of it like editing a document: you modify what needs changing while keeping everything else intact.
When you update a stack, CloudFormation compares your new template with the current stack and determines what needs to be added, modified, or removed. Some updates happen with no disruption, while others might require resource replacement (like changing an EC2 instance type).
What Are Change Sets?
A change set is like a "preview" or "diff" of your proposed changes. Before applying updates, you can create a change set to see exactly what CloudFormation will do:
- Which resources will be added, modified, or deleted
- Whether changes require replacement (causing downtime)
- The specific attributes that will change
This is crucial for production environments where surprises can be costly.
The Safe Update Workflow
- Modify your template with the desired changes
- Create a change set to preview the impact
- Review the change set carefully for unexpected modifications or replacements
- Execute the change set if everything looks correct, or discard it if not
Change sets let you answer "what if?" questions without risking your live infrastructure. They're especially valuable when multiple team members review changes before deployment.
When Updates Happen
Stack updates occur when you modify resources, add new ones, or change parameters you've already set. CloudFormation intelligently handles dependencies and update order.
Key Takeaway: Change sets provide a safety net for stack updates, letting you preview and validate infrastructure changes before applying them to production.