IAM security and governance

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 minCaller permissionsScope permissions for stack operations, reads, updates and deletes.Concepts, commands, lab, production and troubleshooting
206–13 · 7 minCloudFormation service rolesSeparate caller authority from the service role used to provision resources.Concepts, commands, lab, production and troubleshooting
313–21 · 8 miniam:PassRole boundaryConstrain which roles a deployment principal can pass to CloudFormation.Concepts, commands, lab, production and troubleshooting
421–29 · 8 minIAM capability acknowledgementsReview CAPABILITY_IAM and CAPABILITY_NAMED_IAM before deploying IAM resources.Concepts, commands, lab, production and troubleshooting
529–37 · 8 minSecrets and dynamic referencesKeep plaintext out of templates and use supported secret references with narrow access.Concepts, commands, lab, production and troubleshooting
637–45 · 8 minCloudFormation GuardValidate templates against organization rules in a pre-deployment workflow.Concepts, commands, lab, production and troubleshooting
745–52 · 7 minCloudFormation HooksUse hooks to evaluate resource operations and provide guardrail feedback.Concepts, commands, lab, production and troubleshooting
852–60 · 8 minSCPs, stack policies and controlsLayer organizational boundaries, IAM and stack-level protections correctly.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.

Caller permissions

Hour 6 · 1 / 8

Core concepts

Scope permissions for stack operations, reads, updates and deletes.

  • 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: Caller permissions
Template → Validate → Change set → Review → Execute → Caller permissions → 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: Caller permissions
  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 iam simulate-principal-policy --policy-source-arn arn:aws:iam::123456789012:role/CfnDeploy --action-names cloudformation:UpdateStack

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: Scope permissions for stack operations, reads, updates and deletes.

  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: Scope permissions for stack operations, reads, updates and deletes.

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: Scope permissions for stack operations, reads, updates and deletes.

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

Narration script

Scope permissions for stack operations, reads, updates and deletes.

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 ↗

CloudFormation service roles

Hour 6 · 2 / 8

Core concepts

Separate caller authority from the service role used to provision 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: CloudFormation service roles
Template → Validate → Change set → Review → Execute → CloudFormation service roles → 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: CloudFormation service roles
  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].RoleARN

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 caller authority from the service role used to provision 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 caller authority from the service role used to provision 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 caller authority from the service role used to provision resources.

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

Narration script

Separate caller authority from the service role used to provision 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 ↗

iam:PassRole boundary

Hour 6 · 3 / 8

Core concepts

Constrain which roles a deployment principal can pass to CloudFormation.

  • 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: iam:PassRole boundary
Template → Validate → Change set → Review → Execute → iam:PassRole boundary → 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: iam:PassRole boundary
  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 iam simulate-principal-policy --policy-source-arn arn:aws:iam::123456789012:role/CfnDeploy --action-names iam:PassRole

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: Constrain which roles a deployment principal can pass to CloudFormation.

  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: Constrain which roles a deployment principal can pass to CloudFormation.

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: Constrain which roles a deployment principal can pass to CloudFormation.

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

Narration script

Constrain which roles a deployment principal can pass to CloudFormation.

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 ↗

IAM capability acknowledgements

Hour 6 · 4 / 8

Core concepts

Review CAPABILITY_IAM and CAPABILITY_NAMED_IAM before deploying IAM 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: IAM capability acknowledgements
Template → Validate → Change set → Review → Execute → IAM capability acknowledgements → 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: IAM capability acknowledgements
  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-template-summary --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: Review CAPABILITY_IAM and CAPABILITY_NAMED_IAM before deploying IAM 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: Review CAPABILITY_IAM and CAPABILITY_NAMED_IAM before deploying IAM 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: Review CAPABILITY_IAM and CAPABILITY_NAMED_IAM before deploying IAM resources.

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

Narration script

Review CAPABILITY_IAM and CAPABILITY_NAMED_IAM before deploying IAM 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 ↗

Secrets and dynamic references

Hour 6 · 5 / 8

Core concepts

Keep plaintext out of templates and use supported secret references with narrow access.

  • 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: Secrets and dynamic references
Template → Validate → Change set → Review → Execute → Secrets and dynamic references → 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: Secrets and dynamic references
  2. Validate the inputs and inspect the proposed resource action
  3. Execute in a sandbox and verify the resulting stack events

Commands and notes

cfn-guard validate --rules policy.guard --data 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: Keep plaintext out of templates and use supported secret references with narrow access.

  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: Keep plaintext out of templates and use supported secret references with narrow access.

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: Keep plaintext out of templates and use supported secret references with narrow access.

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

Narration script

Keep plaintext out of templates and use supported secret references with narrow access.

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 ↗

CloudFormation Guard

Hour 6 · 6 / 8

Core concepts

Validate templates against organization rules in a pre-deployment workflow.

  • 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: CloudFormation Guard
Template → Validate → Change set → Review → Execute → CloudFormation Guard → 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: CloudFormation Guard
  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-types --visibility PUBLIC --type RESOURCE

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 templates against organization rules in a pre-deployment workflow.

  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 templates against organization rules in a pre-deployment workflow.

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 templates against organization rules in a pre-deployment workflow.

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

Narration script

Validate templates against organization rules in a pre-deployment workflow.

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 ↗

CloudFormation Hooks

Hour 6 · 7 / 8

Core concepts

Use hooks to evaluate resource operations and provide guardrail feedback.

  • 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: CloudFormation Hooks
Template → Validate → Change set → Review → Execute → CloudFormation Hooks → 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: CloudFormation Hooks
  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-types --type HOOK --visibility PRIVATE

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: Use hooks to evaluate resource operations and provide guardrail feedback.

  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: Use hooks to evaluate resource operations and provide guardrail feedback.

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: Use hooks to evaluate resource operations and provide guardrail feedback.

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

Narration script

Use hooks to evaluate resource operations and provide guardrail feedback.

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 ↗

SCPs, stack policies and controls

Hour 6 · 8 / 8

Core concepts

Layer organizational boundaries, IAM and stack-level protections correctly.

  • 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: SCPs, stack policies and controls
Template → Validate → Change set → Review → Execute → SCPs, stack policies and controls → 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: SCPs, stack policies and controls
  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 organizations describe-organization

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: Layer organizational boundaries, IAM and stack-level protections correctly.

  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: Layer organizational boundaries, IAM and stack-level protections correctly.

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: Layer organizational boundaries, IAM and stack-level protections correctly.

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

Narration script

Layer organizational boundaries, IAM and stack-level protections correctly.

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.