Resources and lifecycle safety

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 minResource specificationsCheck required properties, supported Regions, return values and update behavior.Concepts, commands, lab, production and troubleshooting
206–13 · 7 minDependency graphsLet references express dependencies and use DependsOn only for genuine ordering rules.Concepts, commands, lab, production and troubleshooting
313–21 · 8 minUpdate and replacementDistinguish in-place updates from replacement using resource references and change sets.Concepts, commands, lab, production and troubleshooting
421–29 · 8 minDeletionPolicy and retentionChoose deletion and snapshot behavior for data-bearing resources.Concepts, commands, lab, production and troubleshooting
529–37 · 8 minUpdateReplacePolicyControl the old physical resource when an update replaces a resource.Concepts, commands, lab, production and troubleshooting
637–45 · 8 minCreationPolicy and cfn-signalWait for supported bootstrap workflows and diagnose missing signals.Concepts, commands, lab, production and troubleshooting
745–52 · 7 minStack policies and termination protectionProtect critical resources from accidental updates and stack deletion.Concepts, commands, lab, production and troubleshooting
852–60 · 8 minDrift and resource ownershipUnderstand drift coverage and reconcile configuration changes made outside the stack.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.

Resource specifications

Hour 3 · 1 / 8

Core concepts

Check required properties, supported Regions, return values and update behavior.

  • 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: Resource specifications
Template → Validate → Change set → Review → Execute → Resource specifications → 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: Resource specifications
  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-type --type RESOURCE --type-name AWS::SQS::Queue

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 required properties, supported Regions, return values and update behavior.

  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 required properties, supported Regions, return values and update behavior.

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 required properties, supported Regions, return values and update behavior.

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

Narration script

Check required properties, supported Regions, return values and update behavior.

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 ↗

Dependency graphs

Hour 3 · 2 / 8

Core concepts

Let references express dependencies and use DependsOn only for genuine ordering rules.

  • 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: Dependency graphs
Template → Validate → Change set → Review → Execute → Dependency graphs → 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: Dependency graphs
  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-resources --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: Let references express dependencies and use DependsOn only for genuine ordering rules.

  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: Let references express dependencies and use DependsOn only for genuine ordering rules.

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: Let references express dependencies and use DependsOn only for genuine ordering rules.

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

Narration script

Let references express dependencies and use DependsOn only for genuine ordering rules.

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 ↗

Update and replacement

Hour 3 · 3 / 8

Core concepts

Distinguish in-place updates from replacement using resource references and change sets.

  • 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: Update and replacement
Template → Validate → Change set → Review → Execute → Update and replacement → 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: Update and replacement
  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: Distinguish in-place updates from replacement using resource references and change sets.

  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: Distinguish in-place updates from replacement using resource references and change sets.

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: Distinguish in-place updates from replacement using resource references and change sets.

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

Narration script

Distinguish in-place updates from replacement using resource references and change sets.

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 ↗

DeletionPolicy and retention

Hour 3 · 4 / 8

Core concepts

Choose deletion and snapshot behavior for data-bearing 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: DeletionPolicy and retention
Template → Validate → Change set → Review → Execute → DeletionPolicy and retention → 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: DeletionPolicy and retention
  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-resource --stack-name app-dev --logical-resource-id CourseQueue

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: Choose deletion and snapshot behavior for data-bearing 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: Choose deletion and snapshot behavior for data-bearing 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: Choose deletion and snapshot behavior for data-bearing resources.

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

Narration script

Choose deletion and snapshot behavior for data-bearing 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 ↗

UpdateReplacePolicy

Hour 3 · 5 / 8

Core concepts

Control the old physical resource when an update replaces a resource.

  • 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: UpdateReplacePolicy
Template → Validate → Change set → Review → Execute → UpdateReplacePolicy → 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: UpdateReplacePolicy
  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-resources --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: Control the old physical resource when an update replaces a resource.

  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: Control the old physical resource when an update replaces a resource.

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: Control the old physical resource when an update replaces a resource.

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

Narration script

Control the old physical resource when an update replaces a resource.

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 ↗

CreationPolicy and cfn-signal

Hour 3 · 6 / 8

Core concepts

Wait for supported bootstrap workflows and diagnose missing signals.

  • 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: CreationPolicy and cfn-signal
Template → Validate → Change set → Review → Execute → CreationPolicy and cfn-signal → 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: CreationPolicy and cfn-signal
  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

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: Wait for supported bootstrap workflows and diagnose missing signals.

  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: Wait for supported bootstrap workflows and diagnose missing signals.

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: Wait for supported bootstrap workflows and diagnose missing signals.

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

Narration script

Wait for supported bootstrap workflows and diagnose missing signals.

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 ↗

Stack policies and termination protection

Hour 3 · 7 / 8

Core concepts

Protect critical resources from accidental updates and stack deletion.

  • 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: Stack policies and termination protection
Template → Validate → Change set → Review → Execute → Stack policies and termination protection → 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: Stack policies and termination protection
  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 get-stack-policy --stack-name app-prod

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: Protect critical resources from accidental updates and stack deletion.

  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: Protect critical resources from accidental updates and stack deletion.

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: Protect critical resources from accidental updates and stack deletion.

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

Narration script

Protect critical resources from accidental updates and stack deletion.

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 and resource ownership

Hour 3 · 8 / 8

Core concepts

Understand drift coverage and reconcile configuration changes made outside the stack.

  • 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 and resource ownership
Template → Validate → Change set → Review → Execute → Drift and resource ownership → 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 and resource ownership
  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-resource-drifts --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: Understand drift coverage and reconcile configuration changes made outside the stack.

  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 drift coverage and reconcile configuration changes made outside the stack.

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 drift coverage and reconcile configuration changes made outside the stack.

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

Narration script

Understand drift coverage and reconcile configuration changes made outside the stack.

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.