Topic lessonTopic: IaC and CloudFormation: configuration, changes and drift
CloudFormation change sets: reviewing changes, replacement and deletion
A CloudFormation change set lets you review proposed changes before executing them. Determine whether resources will be added, modified or replaced. Distinguish a completed preview, pre-deployment validation and successful execution.
Interpret Add, Modify, Remove and Replacement; explain validation warnings, drift-aware comparisons and retention during removal versus replacement.
A template defines resources; a stack groups them for management. Replacement creates a new physical resource. You will read synthetic differences without creating or executing anything in AWS.
Creating a change set is different from executing it
Create a change set from a proposed template or inputs, inspect it, then decide whether to execute. CREATE_COMPLETE as a change-set status means the preview was created. Do not read it as the stack status or application health.
- Proposal → Change setCreate
- Change set → Decide whether to runReview
- Decide whether to run → Verify after applyingIf executed
- Proposal
- Template and inputs
- Change set
- Differences and validation
- Decide whether to run
- Impact, target, conditions
- Verify after applying
- Operation and functions
Modify can still involve replacement
| Display | Meaning | What else to inspect |
|---|---|---|
| Add | Add a resource. | New costs, permissions and relationships. |
| Modify | Change an existing logical resource. | Properties affected, interruption and replacement. |
| Remove | Remove a resource from the stack. | Removal policy and any retained resources or data. |
| Replacement: True / False / Conditional | Whether replacement is required, unnecessary or conditional. | Conditions behind Conditional, physical IDs and consumer impact. |
Modify does not mean no interruption. Update behavior depends on the resource type and property. Follow the detailed differences to identify replacement and affected references or consumers; do not dismiss conditional replacement.
Pre-deployment validation helps; warnings still require review
CloudFormation currently runs pre-deployment validation by default for stack creation, updates and change-set creation. Some checks cover syntax or name conflicts; other constraint checks apply specifically when creating change sets. This is neither an unchecked preview nor a guarantee of successful execution.
| Mode | When a problem is detected | Review decision |
|---|---|---|
| FAIL | Stops the operation on a validation error; a change set becomes FAILED. | Resolve the issue and create a preview of the revised proposal. |
| WARN | Change-set creation can succeed with warnings. | Review the warning and its remedy before deciding to execute. |
Distinguish the previous definition from actual state
| State | Fixed example | Meaning |
|---|---|---|
| Previous deployment | 80 | Value defined by the earlier deployment. |
| Actual state | 443 | Current value after an out-of-band change. |
| Desired state | 80 | Value requested by the proposed template. |
Traditional change sets compare previous and proposed templates rather than accounting for drift. A drift-aware change set also considers actual state for supported resources and properties. This example shows why an unchanged definition of 80 can still imply overwriting a live value of 443.
Removal and replacement use different retention policies
| Attribute | When it applies | Checks still needed after retention |
|---|---|---|
| DeletionPolicy | Deleting a stack or removing a resource from the template. | Retain leaves the resource outside stack management; track ownership and cost. |
| UpdateReplacePolicy | The old physical resource during an update replacement. | Retain does not migrate data or switch consumers to the replacement. |
DeletionPolicy: Retain
UpdateReplacePolicy: RetainPractice interpreting a change set
Choose an option to see the result and explanation.
Check, then explain in your own words
- Read Action together with Replacement.
- Explain previous, actual and desired values.
- Separate retention from data migration when planning the review.
Check your understanding: After a change set is created, what should you inspect before execution?
Check targets and inputs, actions, replacement conditions, validation warnings, differences from actual state, and effects on deletion, retention and data cutover.
A completed preview does not guarantee a suitable change or successful execution.
Sources and conditions checked
The official references used in this lesson are collected here with their scope, conditions and corresponding sections. Independent expert review and live AWS comparison have not been performed.
- Update stacks using change setsChecked:
Scope and conditionsSeparate preview creation from execution; validation does not guarantee runtime success. Documentation review; not live AWS validation.
Used in this lessonCreating a change set is different from executing it Pre-deployment validation helps; warnings still require review Practice interpreting a change set
- Create a change setChecked:
Scope and conditionsReview template, parameters, target and nested coverage. Interpret CREATE_COMPLETE in its change-set context. Documentation review; not live AWS validation.
Used in this lessonCreating a change set is different from executing it
Scope and conditionsDistinguish CloudFormation and underlying-service permissions; capability acknowledgement is not a permission grant. Documentation review; not live AWS validation.
Used in this lessonCreating a change set is different from executing it
- View a change setChecked:
Scope and conditionsDistinguish Action, Replacement and property differences; Modify does not imply no interruption. Documentation review; not live AWS validation.
Used in this lessonModify can still involve replacement Practice interpreting a change set
Scope and conditionsType and property determine no-interruption updates, interruption or replacement and effects on physical identifiers. Documentation review; not live AWS validation.
Used in this lessonModify can still involve replacement
- Validate stack deploymentsChecked:
Scope and conditionsDefault validation and operation-specific coverage; FAIL stops versus WARN creation, and revalidation of changed proposals. Documentation review; not live AWS validation.
Used in this lessonPre-deployment validation helps; warnings still require review Practice interpreting a change set
- Using drift-aware change setsChecked:
Scope and conditionsThree-way comparison; unsupported types, write-only values, AWS-managed settings, external tags, immutable properties and cross-stack attachments limit reconciliation. Documentation review; not live AWS validation.
Used in this lessonDistinguish the previous definition from actual state Practice interpreting a change set
- DeletionPolicy attributeChecked:
Scope and conditionsRetention on stack deletion or resource removal; replacement uses a different attribute. Track retained ownership and costs. Documentation review; not live AWS validation.
Used in this lessonRemoval and replacement use different retention policies Practice interpreting a change set
- UpdateReplacePolicy attributeChecked:
Scope and conditionsApplies to the old physical resource at replacement; retention is not migration, recovery or availability, and Snapshot support varies. Documentation review; not live AWS validation.
Used in this lessonRemoval and replacement use different retention policies Practice interpreting a change set