INFRASTRUCTURE LEARNINGINFRASTRUCTURE LEARNING
インフラ大全インフラ大全IT INFRASTRUCTURE / LEARNING
Infrastructure learning guide
Find a lesson or lab/

Esc to close · Search terms stay on your device

LEARNING日本語

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.

What you will learn

Interpret Add, Modify, Remove and Replacement; explain validation warnings, drift-aware comparisons and retention during removal versus replacement.

Prerequisite

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.

Move from proposed differences to an execution decision
Move from proposed differences to an execution decision1: Proposal — Create — Change set. 2: Change set — Review — Decide whether to run. 3: Decide whether to run — If executed — Verify after applying123ProposalChange setDecide whether torunVerify afterapplyingMove from proposed differences to an execution decision1: Proposal — Create — Change set. 2: Change set — Review — Decide whether to run. 3: Decide whether to run — If executed — Verify after applying123ProposalChange setDecide whetherto runVerify afterapplying
  1. Proposal → Change setCreate
  2. Change set → Decide whether to runReview
  3. 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

Read Action and Replacement separately
DisplayMeaningWhat else to inspect
AddAdd a resource.New costs, permissions and relationships.
ModifyChange an existing logical resource.Properties affected, interruption and replacement.
RemoveRemove a resource from the stack.Removal policy and any retained resources or data.
Replacement: True / False / ConditionalWhether 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.

FAIL and WARN have different consequences
ModeWhen a problem is detectedReview decision
FAILStops the operation on a validation error; a change set becomes FAILED.Resolve the issue and create a preview of the revised proposal.
WARNChange-set creation can succeed with warnings.Review the warning and its remedy before deciding to execute.

Distinguish the previous definition from actual state

Read three states of an illustrative setting
StateFixed exampleMeaning
Previous deployment80Value defined by the earlier deployment.
Actual state443Current value after an out-of-band change.
Desired state80Value 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

Match the policy to the operation
AttributeWhen it appliesChecks still needed after retention
DeletionPolicyDeleting a stack or removing a resource from the template.Retain leaves the resource outside stack management; track ownership and cost.
UpdateReplacePolicyThe old physical resource during an update replacement.Retain does not migrate data or switch consumers to the replacement.
An excerpt showing only the two retention attributesScroll horizontally to read long lines. Use arrow keys in the code area.
DeletionPolicy: Retain
UpdateReplacePolicy: Retain

Practice interpreting a change set

Choose an option to see the result and explanation.

The change set itself is CREATE_COMPLETE. What has completed?
Read the answer and reason

Answer: Creation of the proposed-change preview · Creation of the preview is separate from a stack update after execution.

If Action is Modify, can you rule out interruption or replacement?
Read the answer and reason

Answer: No; inspect Replacement and the detailed differences · Some modifications require replacement; inspect the actual impact.

A change set was created with a WARN result. Is execution guaranteed to succeed?
Read the answer and reason

Answer: No; review the warning and required remedy · Treat successful creation, warnings and execution results as separate evidence.

Previous 80, actual 443, proposed 80: what should you review?
Read the answer and reason

Answer: The effect and rationale of reverting the live value from 443 to 80 · For supported drift-aware comparisons, review changes hidden by a template-only comparison.

Which attribute governs the old physical resource during an update replacement?
Read the answer and reason

Answer: UpdateReplacePolicy · Distinguish old physical resources during replacement from removal governed by DeletionPolicy.

The old database resource is retained. Does that complete migration to the replacement?
Read the answer and reason

Answer: No; separately plan migration, cutover, recovery and ownership · Retention alone does not establish usable or correct data on the replacement.

Check, then explain in your own words

  1. Read Action together with Replacement.
  2. Explain previous, actual and desired values.
  3. 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.