Stack operations and recovery

AWS CloudFormation · 60 minutes · 8 modules
AWS CloudFormationAWS CLI v2Core hour
Learning objectives
  • Work through concepts, commands and troubleshooting in all eight modules.
  • Review changesets and verify resource lifecycle behavior in a sandbox.
  • Explain deployment results using stack events, outputs and service evidence.

1-hour schedule

#TimeModuleCore contentLearning views
100–06 · 6 minCreate, update and deleteUnderstand stack operation commands, capabilities and no-op updates.Concepts, commands, lab, production and troubleshooting
206–13 · 7 minChange set workflowCreate and inspect proposed changes before execution.Concepts, commands, lab, production and troubleshooting
313–21 · 8 minReplacement and impact reviewReview resource-level actions, replacements, deletes and property changes.Concepts, commands, lab, production and troubleshooting
421–29 · 8 minEvents and status reasonsLocate the first failure and separate root causes from cascading events.Concepts, commands, lab, production and troubleshooting
529–37 · 8 minRollback behaviorUnderstand automatic rollback, disabled rollback and retained resources.Concepts, commands, lab, production and troubleshooting
637–45 · 8 minContinue update rollbackRecover UPDATE_ROLLBACK_FAILED stacks after fixing the underlying cause.Concepts, commands, lab, production and troubleshooting
745–52 · 7 minDrift-aware change reviewCheck unmanaged changes before risky updates and reconcile safely.Concepts, commands, lab, production and troubleshooting
852–60 · 8 minSafe deletion and cleanupPlan stack deletion, retained-resource inventory and cost cleanup.Concepts, commands, lab, production and troubleshooting

How to use this course

Each module includes concepts, a diagram, a walkthrough, commands, a lab, a production case, troubleshooting, a quiz, narration and official references. Progress is saved in this browser.

Lab requirements: AWS CLI v2, a sandbox account and least-privilege permissions. Verify account/Region before labs and clean up afterward.

Setup

Prepare AWS CLI v2, a sandbox account and deployment permissions. Verify identity and Region; do not run labs in a production account.

aws --version
aws sts get-caller-identity --profile sandbox
aws configure list --profile sandbox

Labs may create resources. Follow each lab's cleanup steps and verify stack status when finished.

Create, update and delete

Hour 4 · 1 / 8

Core concepts

Understand stack operation commands, capabilities and no-op updates.

  • Check the resource reference for properties and update behavior.
  • Make the relationship between template, parameters, execution identity and target environment explicit.
  • Record an observable expected result and cleanup method.

Request path

Focus: Create, update and delete
Template → Validate → Change set → Review → Execute → Create, update and delete → Verify events

Keep reviewable inputs and results at each stage; a change set does not apply proposed changes until execution.

Deployment state sequence

  1. Identify the requirement: Create, update and delete
  2. Validate the inputs and inspect the proposed resource action
  3. Execute in a sandbox and verify the resulting stack events

Commands and notes

aws cloudformation create-stack --stack-name app-dev --template-body file://template.yaml

Confirm profile, account and Region first. Replace example names with sandbox resources.

Hands-on lab

Apply this module to a disposable sandbox stack. Record the input, command, expected CloudFormation event or result, and cleanup step. Verify the outcome before moving to the next module: Understand stack operation commands, capabilities and no-op updates.

  1. Run the command and save its output.
  2. Compare it with the expected result and record differences.
  3. Delete the lab stack and confirm there are no leftover resources.

Production case review

Production review: make this behavior explicit in the template and change review. Confirm ownership, blast radius, rollback or retention behavior, and the evidence an operator can use during an incident. Topic: Understand stack operation commands, capabilities and no-op updates.

Release gate Inspect replacements and deletions; confirm approval, backups and rollback ownership.

Troubleshooting path

If the operation fails, capture the stack status, logical resource ID and earliest failed event. Separate template, permission, quota, service stabilization and dependency causes; fix the source, then create a fresh change set before retrying. Topic: Understand stack operation commands, capabilities and no-op updates.

aws cloudformation describe-stack-events --stack-name app-dev --region us-east-1

Narration script

Understand stack operation commands, capabilities and no-op updates.

The key is to record the desired state in a template, execute it through a stack, and use event evidence to verify the result.

Official learning resources

Work through the AWS User Guide and CloudFormation Workshop. This lesson emphasizes reviewable text-based labs.

AWS CloudFormation User Guide ↗

Change set workflow

Hour 4 · 2 / 8

Core concepts

Create and inspect proposed changes before execution.

  • Check the resource reference for properties and update behavior.
  • Make the relationship between template, parameters, execution identity and target environment explicit.
  • Record an observable expected result and cleanup method.

Request path

Focus: Change set workflow
Template → Validate → Change set → Review → Execute → Change set workflow → Verify events

Keep reviewable inputs and results at each stage; a change set does not apply proposed changes until execution.

Deployment state sequence

  1. Identify the requirement: Change set workflow
  2. Validate the inputs and inspect the proposed resource action
  3. Execute in a sandbox and verify the resulting stack events

Commands and notes

aws cloudformation create-change-set --stack-name app-dev --change-set-name review-1 --change-set-type UPDATE --template-body file://template.yaml

Confirm profile, account and Region first. Replace example names with sandbox resources.

Hands-on lab

Apply this module to a disposable sandbox stack. Record the input, command, expected CloudFormation event or result, and cleanup step. Verify the outcome before moving to the next module: Create and inspect proposed changes before execution.

  1. Run the command and save its output.
  2. Compare it with the expected result and record differences.
  3. Delete the lab stack and confirm there are no leftover resources.

Production case review

Production review: make this behavior explicit in the template and change review. Confirm ownership, blast radius, rollback or retention behavior, and the evidence an operator can use during an incident. Topic: Create and inspect proposed changes before execution.

Release gate Inspect replacements and deletions; confirm approval, backups and rollback ownership.

Troubleshooting path

If the operation fails, capture the stack status, logical resource ID and earliest failed event. Separate template, permission, quota, service stabilization and dependency causes; fix the source, then create a fresh change set before retrying. Topic: Create and inspect proposed changes before execution.

aws cloudformation describe-stack-events --stack-name app-dev --region us-east-1

Narration script

Create and inspect proposed changes before execution.

The key is to record the desired state in a template, execute it through a stack, and use event evidence to verify the result.

Official learning resources

Work through the AWS User Guide and CloudFormation Workshop. This lesson emphasizes reviewable text-based labs.

AWS CloudFormation User Guide ↗

Replacement and impact review

Hour 4 · 3 / 8

Core concepts

Review resource-level actions, replacements, deletes and property changes.

  • Check the resource reference for properties and update behavior.
  • Make the relationship between template, parameters, execution identity and target environment explicit.
  • Record an observable expected result and cleanup method.

Request path

Focus: Replacement and impact review
Template → Validate → Change set → Review → Execute → Replacement and impact review → Verify events

Keep reviewable inputs and results at each stage; a change set does not apply proposed changes until execution.

Deployment state sequence

  1. Identify the requirement: Replacement and impact review
  2. Validate the inputs and inspect the proposed resource action
  3. Execute in a sandbox and verify the resulting stack events

Commands and notes

aws cloudformation describe-change-set --stack-name app-dev --change-set-name review-1

Confirm profile, account and Region first. Replace example names with sandbox resources.

Hands-on lab

Apply this module to a disposable sandbox stack. Record the input, command, expected CloudFormation event or result, and cleanup step. Verify the outcome before moving to the next module: Review resource-level actions, replacements, deletes and property changes.

  1. Run the command and save its output.
  2. Compare it with the expected result and record differences.
  3. Delete the lab stack and confirm there are no leftover resources.

Production case review

Production review: make this behavior explicit in the template and change review. Confirm ownership, blast radius, rollback or retention behavior, and the evidence an operator can use during an incident. Topic: Review resource-level actions, replacements, deletes and property changes.

Release gate Inspect replacements and deletions; confirm approval, backups and rollback ownership.

Troubleshooting path

If the operation fails, capture the stack status, logical resource ID and earliest failed event. Separate template, permission, quota, service stabilization and dependency causes; fix the source, then create a fresh change set before retrying. Topic: Review resource-level actions, replacements, deletes and property changes.

aws cloudformation describe-stack-events --stack-name app-dev --region us-east-1

Narration script

Review resource-level actions, replacements, deletes and property changes.

The key is to record the desired state in a template, execute it through a stack, and use event evidence to verify the result.

Official learning resources

Work through the AWS User Guide and CloudFormation Workshop. This lesson emphasizes reviewable text-based labs.

AWS CloudFormation User Guide ↗

Events and status reasons

Hour 4 · 4 / 8

Core concepts

Locate the first failure and separate root causes from cascading events.

  • Check the resource reference for properties and update behavior.
  • Make the relationship between template, parameters, execution identity and target environment explicit.
  • Record an observable expected result and cleanup method.

Request path

Focus: Events and status reasons
Template → Validate → Change set → Review → Execute → Events and status reasons → Verify events

Keep reviewable inputs and results at each stage; a change set does not apply proposed changes until execution.

Deployment state sequence

  1. Identify the requirement: Events and status reasons
  2. Validate the inputs and inspect the proposed resource action
  3. Execute in a sandbox and verify the resulting stack events

Commands and notes

aws cloudformation describe-stack-events --stack-name app-dev --max-items 30

Confirm profile, account and Region first. Replace example names with sandbox resources.

Hands-on lab

Apply this module to a disposable sandbox stack. Record the input, command, expected CloudFormation event or result, and cleanup step. Verify the outcome before moving to the next module: Locate the first failure and separate root causes from cascading events.

  1. Run the command and save its output.
  2. Compare it with the expected result and record differences.
  3. Delete the lab stack and confirm there are no leftover resources.

Production case review

Production review: make this behavior explicit in the template and change review. Confirm ownership, blast radius, rollback or retention behavior, and the evidence an operator can use during an incident. Topic: Locate the first failure and separate root causes from cascading events.

Release gate Inspect replacements and deletions; confirm approval, backups and rollback ownership.

Troubleshooting path

If the operation fails, capture the stack status, logical resource ID and earliest failed event. Separate template, permission, quota, service stabilization and dependency causes; fix the source, then create a fresh change set before retrying. Topic: Locate the first failure and separate root causes from cascading events.

aws cloudformation describe-stack-events --stack-name app-dev --region us-east-1

Narration script

Locate the first failure and separate root causes from cascading events.

The key is to record the desired state in a template, execute it through a stack, and use event evidence to verify the result.

Official learning resources

Work through the AWS User Guide and CloudFormation Workshop. This lesson emphasizes reviewable text-based labs.

AWS CloudFormation User Guide ↗

Rollback behavior

Hour 4 · 5 / 8

Core concepts

Understand automatic rollback, disabled rollback and retained resources.

  • Check the resource reference for properties and update behavior.
  • Make the relationship between template, parameters, execution identity and target environment explicit.
  • Record an observable expected result and cleanup method.

Request path

Focus: Rollback behavior
Template → Validate → Change set → Review → Execute → Rollback behavior → Verify events

Keep reviewable inputs and results at each stage; a change set does not apply proposed changes until execution.

Deployment state sequence

  1. Identify the requirement: Rollback behavior
  2. Validate the inputs and inspect the proposed resource action
  3. Execute in a sandbox and verify the resulting stack events

Commands and notes

aws cloudformation describe-stacks --stack-name app-dev --query Stacks[0].StackStatus

Confirm profile, account and Region first. Replace example names with sandbox resources.

Hands-on lab

Apply this module to a disposable sandbox stack. Record the input, command, expected CloudFormation event or result, and cleanup step. Verify the outcome before moving to the next module: Understand automatic rollback, disabled rollback and retained resources.

  1. Run the command and save its output.
  2. Compare it with the expected result and record differences.
  3. Delete the lab stack and confirm there are no leftover resources.

Production case review

Production review: make this behavior explicit in the template and change review. Confirm ownership, blast radius, rollback or retention behavior, and the evidence an operator can use during an incident. Topic: Understand automatic rollback, disabled rollback and retained resources.

Release gate Inspect replacements and deletions; confirm approval, backups and rollback ownership.

Troubleshooting path

If the operation fails, capture the stack status, logical resource ID and earliest failed event. Separate template, permission, quota, service stabilization and dependency causes; fix the source, then create a fresh change set before retrying. Topic: Understand automatic rollback, disabled rollback and retained resources.

aws cloudformation describe-stack-events --stack-name app-dev --region us-east-1

Narration script

Understand automatic rollback, disabled rollback and retained resources.

The key is to record the desired state in a template, execute it through a stack, and use event evidence to verify the result.

Official learning resources

Work through the AWS User Guide and CloudFormation Workshop. This lesson emphasizes reviewable text-based labs.

AWS CloudFormation User Guide ↗

Continue update rollback

Hour 4 · 6 / 8

Core concepts

Recover UPDATE_ROLLBACK_FAILED stacks after fixing the underlying cause.

  • Check the resource reference for properties and update behavior.
  • Make the relationship between template, parameters, execution identity and target environment explicit.
  • Record an observable expected result and cleanup method.

Request path

Focus: Continue update rollback
Template → Validate → Change set → Review → Execute → Continue update rollback → Verify events

Keep reviewable inputs and results at each stage; a change set does not apply proposed changes until execution.

Deployment state sequence

  1. Identify the requirement: Continue update rollback
  2. Validate the inputs and inspect the proposed resource action
  3. Execute in a sandbox and verify the resulting stack events

Commands and notes

aws cloudformation continue-update-rollback --stack-name app-dev

Confirm profile, account and Region first. Replace example names with sandbox resources.

Hands-on lab

Apply this module to a disposable sandbox stack. Record the input, command, expected CloudFormation event or result, and cleanup step. Verify the outcome before moving to the next module: Recover UPDATE_ROLLBACK_FAILED stacks after fixing the underlying cause.

  1. Run the command and save its output.
  2. Compare it with the expected result and record differences.
  3. Delete the lab stack and confirm there are no leftover resources.

Production case review

Production review: make this behavior explicit in the template and change review. Confirm ownership, blast radius, rollback or retention behavior, and the evidence an operator can use during an incident. Topic: Recover UPDATE_ROLLBACK_FAILED stacks after fixing the underlying cause.

Release gate Inspect replacements and deletions; confirm approval, backups and rollback ownership.

Troubleshooting path

If the operation fails, capture the stack status, logical resource ID and earliest failed event. Separate template, permission, quota, service stabilization and dependency causes; fix the source, then create a fresh change set before retrying. Topic: Recover UPDATE_ROLLBACK_FAILED stacks after fixing the underlying cause.

aws cloudformation describe-stack-events --stack-name app-dev --region us-east-1

Narration script

Recover UPDATE_ROLLBACK_FAILED stacks after fixing the underlying cause.

The key is to record the desired state in a template, execute it through a stack, and use event evidence to verify the result.

Official learning resources

Work through the AWS User Guide and CloudFormation Workshop. This lesson emphasizes reviewable text-based labs.

AWS CloudFormation User Guide ↗

Drift-aware change review

Hour 4 · 7 / 8

Core concepts

Check unmanaged changes before risky updates and reconcile safely.

  • Check the resource reference for properties and update behavior.
  • Make the relationship between template, parameters, execution identity and target environment explicit.
  • Record an observable expected result and cleanup method.

Request path

Focus: Drift-aware change review
Template → Validate → Change set → Review → Execute → Drift-aware change review → Verify events

Keep reviewable inputs and results at each stage; a change set does not apply proposed changes until execution.

Deployment state sequence

  1. Identify the requirement: Drift-aware change review
  2. Validate the inputs and inspect the proposed resource action
  3. Execute in a sandbox and verify the resulting stack events

Commands and notes

aws cloudformation detect-stack-drift --stack-name app-dev

Confirm profile, account and Region first. Replace example names with sandbox resources.

Hands-on lab

Apply this module to a disposable sandbox stack. Record the input, command, expected CloudFormation event or result, and cleanup step. Verify the outcome before moving to the next module: Check unmanaged changes before risky updates and reconcile safely.

  1. Run the command and save its output.
  2. Compare it with the expected result and record differences.
  3. Delete the lab stack and confirm there are no leftover resources.

Production case review

Production review: make this behavior explicit in the template and change review. Confirm ownership, blast radius, rollback or retention behavior, and the evidence an operator can use during an incident. Topic: Check unmanaged changes before risky updates and reconcile safely.

Release gate Inspect replacements and deletions; confirm approval, backups and rollback ownership.

Troubleshooting path

If the operation fails, capture the stack status, logical resource ID and earliest failed event. Separate template, permission, quota, service stabilization and dependency causes; fix the source, then create a fresh change set before retrying. Topic: Check unmanaged changes before risky updates and reconcile safely.

aws cloudformation describe-stack-events --stack-name app-dev --region us-east-1

Narration script

Check unmanaged changes before risky updates and reconcile safely.

The key is to record the desired state in a template, execute it through a stack, and use event evidence to verify the result.

Official learning resources

Work through the AWS User Guide and CloudFormation Workshop. This lesson emphasizes reviewable text-based labs.

AWS CloudFormation User Guide ↗

Safe deletion and cleanup

Hour 4 · 8 / 8

Core concepts

Plan stack deletion, retained-resource inventory and cost cleanup.

  • Check the resource reference for properties and update behavior.
  • Make the relationship between template, parameters, execution identity and target environment explicit.
  • Record an observable expected result and cleanup method.

Request path

Focus: Safe deletion and cleanup
Template → Validate → Change set → Review → Execute → Safe deletion and cleanup → Verify events

Keep reviewable inputs and results at each stage; a change set does not apply proposed changes until execution.

Deployment state sequence

  1. Identify the requirement: Safe deletion and cleanup
  2. Validate the inputs and inspect the proposed resource action
  3. Execute in a sandbox and verify the resulting stack events

Commands and notes

aws cloudformation delete-stack --stack-name cfn-lab

Confirm profile, account and Region first. Replace example names with sandbox resources.

Hands-on lab

Apply this module to a disposable sandbox stack. Record the input, command, expected CloudFormation event or result, and cleanup step. Verify the outcome before moving to the next module: Plan stack deletion, retained-resource inventory and cost cleanup.

  1. Run the command and save its output.
  2. Compare it with the expected result and record differences.
  3. Delete the lab stack and confirm there are no leftover resources.

Production case review

Production review: make this behavior explicit in the template and change review. Confirm ownership, blast radius, rollback or retention behavior, and the evidence an operator can use during an incident. Topic: Plan stack deletion, retained-resource inventory and cost cleanup.

Release gate Inspect replacements and deletions; confirm approval, backups and rollback ownership.

Troubleshooting path

If the operation fails, capture the stack status, logical resource ID and earliest failed event. Separate template, permission, quota, service stabilization and dependency causes; fix the source, then create a fresh change set before retrying. Topic: Plan stack deletion, retained-resource inventory and cost cleanup.

aws cloudformation describe-stack-events --stack-name app-dev --region us-east-1

Narration script

Plan stack deletion, retained-resource inventory and cost cleanup.

The key is to record the desired state in a template, execute it through a stack, and use event evidence to verify the result.

Official learning resources

Work through the AWS User Guide and CloudFormation Workshop. This lesson emphasizes reviewable text-based labs.

AWS CloudFormation User Guide ↗

Cheat sheet

Command card

aws sts get-caller-identity
aws cloudformation validate-template --template-body file://template.yaml
aws cloudformation deploy --template-file template.yaml --stack-name app-dev
aws cloudformation describe-stacks --stack-name app-dev
aws cloudformation describe-stack-events --stack-name app-dev
aws cloudformation detect-stack-drift --stack-name app-dev
aws cloudformation delete-stack --stack-name app-dev

Before an update

  • Confirm account, Region, profile and execution role.
  • Review replacements, deletions and retention behavior in the change set.
  • Check drift, backups, alarms and rollback ownership.

Capstone lab and final quiz

Lab: review and deploy a controlled stack

Open the runnable SQS capstone lab and template ↗

  1. Write a template with a low-risk resource and parameterize the environment name.
  2. Run template checks, create a change set and review resource actions.
  3. Execute the change set in a sandbox and inspect stack events and outputs.
  4. Run drift detection, then clean up resources according to retention policy.

Final quiz

Sources and version notes

CloudFormation resource properties and CLI behavior evolve. Check current AWS documentation before deployment.