CloudFormation foundations

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 minThe AWS IaC modelUnderstand desired state, CloudFormation as the control plane, and how stacks call resource providers.Concepts, commands, lab, production and troubleshooting
206–13 · 7 minTemplates, stacks and resourcesSeparate the reusable template from a regional stack instance and its physical resources.Concepts, commands, lab, production and troubleshooting
313–21 · 8 minResource types and logical IDsRead AWS resource types, logical IDs, physical IDs, properties and return values.Concepts, commands, lab, production and troubleshooting
421–29 · 8 minAccounts, Regions and environmentsMake deployment targets explicit and understand regional stack boundaries.Concepts, commands, lab, production and troubleshooting
529–37 · 8 minIdentity and the CLI toolchainVerify AWS CLI profiles, caller identity, Region and template validation.Concepts, commands, lab, production and troubleshooting
637–45 · 8 minWrite a first YAML templateDeclare a small, private resource with safe defaults and readable metadata.Concepts, commands, lab, production and troubleshooting
745–52 · 7 minValidate and deploy a stackValidate, create and inspect a sandbox stack with AWS CLI v2.Concepts, commands, lab, production and troubleshooting
852–60 · 8 minEvents, outputs and cleanupRead stack events and outputs, then delete lab resources safely.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.

The AWS IaC model

Hour 1 · 1 / 8

Core concepts

Understand desired state, CloudFormation as the control plane, and how stacks call resource providers.

  • 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: The AWS IaC model
Template → Validate → Change set → Review → Execute → The AWS IaC model → 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: The AWS IaC model
  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 sts get-caller-identity --profile sandbox

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 desired state, CloudFormation as the control plane, and how stacks call resource providers.

  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 desired state, CloudFormation as the control plane, and how stacks call resource providers.

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 desired state, CloudFormation as the control plane, and how stacks call resource providers.

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

Narration script

Understand desired state, CloudFormation as the control plane, and how stacks call resource providers.

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 ↗

Templates, stacks and resources

Hour 1 · 2 / 8

Core concepts

Separate the reusable template from a regional stack instance and its physical 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: Templates, stacks and resources
Template → Validate → Change set → Review → Execute → Templates, stacks and resources → 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: Templates, stacks and resources
  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 list-stacks --region us-east-1 --profile sandbox

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: Separate the reusable template from a regional stack instance and its physical 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: Separate the reusable template from a regional stack instance and its physical 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: Separate the reusable template from a regional stack instance and its physical resources.

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

Narration script

Separate the reusable template from a regional stack instance and its physical 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 ↗

Resource types and logical IDs

Hour 1 · 3 / 8

Core concepts

Read AWS resource types, logical IDs, physical IDs, properties and return values.

  • 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 types and logical IDs
Template → Validate → Change set → Review → Execute → Resource types and logical IDs → 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 types and logical IDs
  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 --region us-east-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: Read AWS resource types, logical IDs, physical IDs, properties and return values.

  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: Read AWS resource types, logical IDs, physical IDs, properties and return values.

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: Read AWS resource types, logical IDs, physical IDs, properties and return values.

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

Narration script

Read AWS resource types, logical IDs, physical IDs, properties and return values.

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 ↗

Accounts, Regions and environments

Hour 1 · 4 / 8

Core concepts

Make deployment targets explicit and understand regional stack boundaries.

  • 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: Accounts, Regions and environments
Template → Validate → Change set → Review → Execute → Accounts, Regions and environments → 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: Accounts, Regions and environments
  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 list-stacks --region us-west-2 --profile sandbox

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: Make deployment targets explicit and understand regional stack boundaries.

  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: Make deployment targets explicit and understand regional stack boundaries.

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: Make deployment targets explicit and understand regional stack boundaries.

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

Narration script

Make deployment targets explicit and understand regional stack boundaries.

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 ↗

Identity and the CLI toolchain

Hour 1 · 5 / 8

Core concepts

Verify AWS CLI profiles, caller identity, Region and template validation.

  • 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: Identity and the CLI toolchain
Template → Validate → Change set → Review → Execute → Identity and the CLI toolchain → 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: Identity and the CLI toolchain
  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 configure list --profile sandbox

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: Verify AWS CLI profiles, caller identity, Region and template validation.

  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: Verify AWS CLI profiles, caller identity, Region and template validation.

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: Verify AWS CLI profiles, caller identity, Region and template validation.

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

Narration script

Verify AWS CLI profiles, caller identity, Region and template validation.

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 ↗

Write a first YAML template

Hour 1 · 6 / 8

Core concepts

Declare a small, private resource with safe defaults and readable metadata.

  • 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: Write a first YAML template
Template → Validate → Change set → Review → Execute → Write a first YAML template → 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: Write a first YAML template
  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 validate-template --template-body file://template.yaml --profile sandbox --region us-east-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: Declare a small, private resource with safe defaults and readable metadata.

  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: Declare a small, private resource with safe defaults and readable metadata.

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: Declare a small, private resource with safe defaults and readable metadata.

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

Narration script

Declare a small, private resource with safe defaults and readable metadata.

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 ↗

Validate and deploy a stack

Hour 1 · 7 / 8

Core concepts

Validate, create and inspect a sandbox stack with AWS CLI v2.

  • 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: Validate and deploy a stack
Template → Validate → Change set → Review → Execute → Validate and deploy a stack → 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: Validate and deploy a stack
  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 cfn-lab --template-body file://template.yaml --profile sandbox --region us-east-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: Validate, create and inspect a sandbox stack with AWS CLI v2.

  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: Validate, create and inspect a sandbox stack with AWS CLI v2.

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: Validate, create and inspect a sandbox stack with AWS CLI v2.

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

Narration script

Validate, create and inspect a sandbox stack with AWS CLI v2.

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, outputs and cleanup

Hour 1 · 8 / 8

Core concepts

Read stack events and outputs, then delete lab resources 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: Events, outputs and cleanup
Template → Validate → Change set → Review → Execute → Events, outputs 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: Events, outputs 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 describe-stack-events --stack-name cfn-lab --profile sandbox --region us-east-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: Read stack events and outputs, then delete lab resources 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: Read stack events and outputs, then delete lab resources 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: Read stack events and outputs, then delete lab resources safely.

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

Narration script

Read stack events and outputs, then delete lab resources 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 ↗

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.