CloudFormation provisions and manages resources as stacks from JSON or YAML templates. References establish dependencies between resources. These sections cover template composition, deployment controls, cross-account rollout, and recovery from failed operations.
Template structure and dependencies
CloudFormation turns a JSON or YAML templateA JSON or YAML document that describes the resources CloudFormation should manage. into a stackA group of resources created and managed together from a CloudFormation template., a group of resources managed together. The template describes the resources; references tell CloudFormation which operations must happen first.
How it works
- Define resources under
Resources. A logical IDA name used to identify and reference a resource within its template. is the name used to refer to a resource inside the template. - Supply optional inputs and logic using the sections below.
- Use
Reffor a parameterA typed input supplied to customize a stack when it is created or updated. value or a resource’s identifying value, andFn::GetAttfor a documented attribute. UseFn::Subto substitute string variables orFn::Jointo join strings with a separator. - CloudFormation follows dependencies and runs independent operations in parallel. A referenced resource is created and updated first, then deleted last. Add
DependsOnwhen the required order has no reference. - To change an existing environment, update its stack with the revised template or parameters. CloudFormation compares them with the stack’s current template and parameters to determine resource changes.
| Section | Purpose |
|---|---|
| Parameters | Inputs supplied for creation or update |
| MappingsA lookup table of literal values retrieved with Fn::FindInMap. | Lookup tables |
| ConditionsTemplate logic that determines whether a resource is created or a property value applies. | Decide whether resources exist or properties get values |
| Outputs | Expose selected stack values |
| MetadataAdditional information attached to a template or resource, including configuration read by helper scripts. | Additional template information |
| Rules | Validate parameters together |
| TransformA template instruction that invokes processing on all or part of a template. | Apply template macrosA Lambda-backed processor that rewrites template content before CloudFormation provisions resources., which process template content |
Exam cues
- If the question says a template must return a generated resource attribute, think
Fn::GetAtt, becauseRefreturns the identifying value for that resource type. - If the question says two resources must be ordered without referencing each other, think
DependsOn, because independent operations can run in parallel. - If the question says an existing environment needs revised resource definitions, think a stack update, because CloudFormation applies differences from the submitted template and parameters.
Remember
Resourcesis the only required section.- Creation order reverses for deletion: dependents go first.
Trap: Ref does not always return an ARNAn identifier that uniquely names an AWS resource.. Its return value depends on the resource type.
Create the referenced resource before its dependent.
Complete the remaining stack resources according to their dependencies.
Box details (3)
- Network resource
The referenced resource is created first and deleted last.
- Dependent resource
Ref, GetAtt, Sub, or DependsOn establishes ordering.
- Stack resources
Independent resource operations can run in parallel.
From the AWS docs (14)
- CloudFormation provisions and manages a stack of resources from a JSON or YAML template.
- Resources is the only required template section.
- A template resource has a logical ID, a resource type, and its configuration properties.
- Parameters, Mappings, Conditions, Outputs, Metadata, Rules, and Transform are optional template sections.
- Outputs exposes selected stack values such as resource identifiers.
- Ref returns a parameter value or the resource-specific identifying value documented for a resource.
- Fn::GetAtt returns a named resource attribute documented for that resource type.
- Fn::Sub replaces variables in a string using parameter values, resource identifiers, attributes, or a variable map.
- Fn::Join combines a list of strings with a specified separator.
- A resource reference through Ref, GetAtt, or Sub creates an implicit dependency: the referenced resource is created and updated first and deleted last.
- DependsOn explicitly orders resource operations that CloudFormation might otherwise perform in parallel.
- AWS Infrastructure Composer visualizes and builds CloudFormation templates on a drag-and-drop canvas; its standalone console ends on December 7, 2026, leaving a visual editor in the console pages that embedded it and the full experience in the AWS Toolkit for VS Code.
- If a template omits a resource name, CloudFormation generates a unique physical ID; custom names must be unique across active stacks, so a reused template must change or drop them.
- A CloudFormation stack update compares the submitted template and parameters with the stack's current template and parameters to determine resource changes.
Parameters, mappings, and conditions
ParametersA typed input supplied to customize a stack when it is created or updated., mappingsA lookup table of literal values retrieved with Fn::FindInMap., and conditionsTemplate logic that determines whether a resource is created or a property value applies. let one CloudFormation templateA JSON or YAML document that describes the resources CloudFormation should manage. serve different environments. Parameters are inputs, mappings are lookup tables, and conditions decide which resources or property values apply.
How it works
- Give every parameter a
Type. Supply aDefaultor require an input at stackA group of resources created and managed together from a CloudFormation template. creation. UseAllowedValues,AllowedPattern, string length bounds, or numeric value bounds to reject unsuitable inputs.ConstraintDescriptionexplains a constraint failure. - Use built-in pseudo parametersA built-in value supplied by CloudFormation, such as the current account ID or Region. such as
AWS::Region,AWS::AccountId, andAWS::StackNamefor deployment context. Read literal mapping values withFn::FindInMap. - Attach a
Conditionto resources that should exist only in some environments. UseFn::Iffor property values and returnAWS::NoValueto omit a property. - Resolve environment details with the functions and parameter types below.
To create a Parameter Store parameter, declare an AWS::SSM::Parameter resource. To read an existing AMIAn image containing the software configuration used to launch an EC2 instance. parameter, use the SSM parameter type below. An ssm dynamic referenceA template expression that retrieves a value stored in another service during a stack operation. can also retrieve an existing plaintext String or StringList value.
| Need | Template feature | Behavior |
|---|---|---|
| Current AMI from Parameter Store | AWS::SSM::Parameter::Value<AWS::EC2::Image::Id> |
Takes a key, including an AWS public parameter key, and resolves its latest value |
| Available zone names | Fn::GetAZs |
Empty Region argument uses the stack Region; default-subnet filtering applies |
| One element from a list | Fn::Select |
Uses a zero-based index; invalid indexes or selected null values fail |
| Smaller subnet address ranges | Fn::Cidr |
Returns smaller CIDRA notation identifying an IP address range by its network prefix. blocks, which describe network address ranges |
Exam cues
- If the question says one template must serve test and production, think parameters and conditions, because inputs and conditional resources avoid manual template edits.
- If the question says a string input must match an approved pattern, think
AllowedPattern, because the parameter constraint rejects other values. - If the question says current AMI IDs must work across Regions, think an SSM parameter type with an AWS public parameter key, because the stack operation resolves the value.
- If the question says create a Parameter Store parameter, think
AWS::SSM::Parameterresource, because an SSM parameter type reads an existing key instead.
Remember
UsePreviousValuepreserves the SSM key, not the old resolved value.- SSM parameter types resolve during change setA preview of proposed stack changes that must be executed before CloudFormation applies them. creation; execution uses that resolved value.
Fn::Cidraccepts a count from 1 to 256.Fn::GetAZscan filter out zones without default subnets; its result order can change.
Trap: Selecting a fixed list index does not guarantee that the Availability ZoneAn isolated location within an AWS Region where resources can be placed. exists in every account. Check the available list before selecting an element.
From the AWS docs (18)
- Parameters supplies typed inputs each time a stack is created or updated.
- Type is required for each parameter; a parameter without a Default needs an input value at creation.
- AllowedValues and AllowedPattern constrain allowed parameter values; MinLength and MaxLength constrain strings, and MinValue and MaxValue constrain numbers.
- ConstraintDescription supplies an explanation when a parameter constraint is violated.
- AWS::Region, AWS::AccountId, and AWS::StackName are built-in pseudo parameters supplied by CloudFormation.
- Mappings holds literal lookup values retrieved with Fn::FindInMap.
- A Condition attached to a resource controls whether CloudFormation creates that resource.
- Fn::If selects a value based on a condition; returning AWS::NoValue removes the corresponding property.
- AWS::SSM::Parameter::Value<AWS::EC2::Image::Id> takes a Parameter Store key and resolves its latest value for a stack operation.
- The AWS::SSM::Parameter resource creates a parameter in Systems Manager Parameter Store.
- An ssm dynamic reference retrieves a plaintext String or StringList value from Parameter Store.
- UsePreviousValue on an SSM parameter type preserves the key, not its previously resolved value.
- SSM parameter types resolve at change set creation; executing that change set uses those resolved values.
- AWS public Parameter Store parameters can supply current AMI IDs without a Region-to-AMI mapping.
- Fn::GetAZs returns available Availability Zone names for a Region; an empty Region argument means the stack Region.
- Fn::GetAZs returns zones with default subnets unless none have a default subnet, and its result order can change.
- Fn::Select uses a zero-based list index and fails on an invalid index or a selected null value.
- Fn::Cidr splits an address block into a requested list of smaller CIDR blocks, with count from 1 to 256.
Dynamic references
A dynamic referenceA template expression that retrieves a value stored in another service during a stack operation. tells CloudFormation where to retrieve a value from external storage. This keeps a password out of the templateA JSON or YAML document that describes the resources CloudFormation should manage. while letting a supported resource receive it during provisioning.
How it works
- Store the value outside the template and choose a reference type.
- Put the reference in a supported resource property. CloudFormation resolves it during the relevant stackA group of resources created and managed together from a CloudFormation template. operation.
- For Secrets Manager, use a versionless reference when the current version should apply. Changing only the stored secret does not update an existing resource through CloudFormation; modify the consuming resource in a stack update to retrieve it again.
| Reference or resource | Use |
|---|---|
ssm-secure |
Retrieve an encrypted ParameterA typed input supplied to customize a stack when it is created or updated. Store SecureStringA Parameter Store parameter that stores an encrypted sensitive value. for a supported property |
secretsmanager |
Retrieve a secret or a JSON field; a versionless reference uses AWSCURRENT, the current version label |
ManageMasterUserPassword on an RDS DBCluster |
Let RDS manage its master password with Secrets Manager; omit MasterUserPassword |
AWS::SecretsManager::SecretTargetAttachment |
Add database connection details needed for database credential rotationThe process of updating a secret and the credentials in the service that uses it. |
Exam cues
- If the question says an encrypted Parameter Store password must reach a template resource, think
ssm-secure, because the reference resolves a SecureString for supported properties. - If the question says an RDS cluster should manage its own password in Secrets Manager, think
ManageMasterUserPassword, because RDS manages that credential. - If the question says database secret rotation lacks connection details, think
SecretTargetAttachment, because it adds that information to the secret.
Remember
- A template supports up to 60 dynamic references.
- Secure dynamic references do not work in custom resources. Dynamic references do not work in
AWS::CloudFormation::Initor EC2UserData. - Keep secrets out of primary resource identifiers, where resolved plaintext can appear.
Trap: NoEcho does not redact Outputs or MetadataAdditional information attached to a template or resource, including configuration read by helper scripts.. A SecretTargetAttachment supplies connection details but does not enable rotation by itself.
From the AWS docs (11)
- Dynamic references let CloudFormation retrieve values managed outside the template during stack operations.
- NoEcho masks parameter values in describe results but does not redact Outputs, template Metadata, or resource Metadata.
- The ssm-secure dynamic reference retrieves an encrypted Parameter Store SecureString for supported resource properties while CloudFormation stores the literal reference.
- A secretsmanager dynamic reference retrieves a secret or a selected JSON field; versionless references use AWSCURRENT.
- Changing only a secret value does not make CloudFormation reread it; creation or an update modifying its consuming resource is required.
- Secure dynamic references are unsupported in custom resources, and dynamic references are unsupported in AWS::CloudFormation::Init metadata and EC2 UserData.
- Using sensitive dynamic values in a primary resource identifier can expose the plaintext through that identifier.
- A stack template can contain up to 60 dynamic references.
- ManageMasterUserPassword on AWS::RDS::DBCluster enables Secrets Manager management of the master password and cannot be combined with MasterUserPassword.
- AWS::SecretsManager::SecretTargetAttachment adds database connection details to a secret for database credential rotation.
- SecretTargetAttachment supplies connection information required by database rotation; a rotation configuration is still needed to enable rotation.
Stack tags
CloudFormation stackA group of resources created and managed together from a CloudFormation template. tagsA key-value label attached to a resource for organization or cost tracking. apply shared key-value labels to a stack and resources that support propagation. They help organize resources and track costs without maintaining a separate retagging script.
How it works
- Supply stack-level tags when creating the stack.
- CloudFormation propagates the tags according to each resource type’s support. It also adds its own stack identity tags.
- Add, change, or remove stack tags later to start a stack update that retags supported resources.
Exam cues
- If the question says a cost-center label changes across a stack, think a stack-level tag update, because CloudFormation retags resources that support propagation.
- If the question says EBS volumes created through block device mappingsA lookup table of literal values retrieved with Fn::FindInMap. lack the stack tags, think a propagation exception, because those volumes do not receive stack-level tags.
Remember
- A stack accepts up to 50 user tag pairs.
- CloudFormation adds
aws:cloudformation:logical-id,aws:cloudformation:stack-id, andaws:cloudformation:stack-name. - The
aws:prefix is reserved. Those tags do not count toward resource tag limits.
Trap: PropagateAtLaunch controls Auto Scaling group resource tags. Stack-level tags reach the group’s instances regardless of that setting.
From the AWS docs (7)
- A tag is a key-value label used to organize resources, including cost tracking.
- A CloudFormation stack accepts up to 50 user tag key-value pairs.
- Adding, changing, or removing stack-level tags initiates a stack update that updates resources supporting stack-tag propagation.
- Stack-tag propagation varies by resource type; EBS volumes created from block device mappings do not receive the tags.
- PropagateAtLaunch controls propagation of an Auto Scaling group resource tag to instances, but stack-level tags reach those instances regardless of this setting.
- CloudFormation creates aws:cloudformation:logical-id, aws:cloudformation:stack-id, and aws:cloudformation:stack-name tags.
- The aws: tag prefix is reserved, and those tags do not count toward the resource tag limit.
Change sets and update behavior
A CloudFormation change setA preview of proposed stack changes that must be executed before CloudFormation applies them. is a preview of a proposed stackA group of resources created and managed together from a CloudFormation template. operation. It separates reviewing changes from executing them, so replacementsAn update that provisions a new physical resource in place of the previous one. and removals can be examined before resources change.
How it works
- Submit a templateA JSON or YAML document that describes the resources CloudFormation should manage. or parameterA typed input supplied to customize a stack when it is created or updated. changes to create a change set. Creation checks common errors such as invalid properties, name conflicts, and quota constraints.
- Review resource changes,
Scope, and replacement risk. For nested stacks, setIncludeNestedStackstotrueand inspect the whole hierarchy. - Execute the selected change set from the root. CloudFormation applies changes in dependencyA relationship that requires one resource operation to complete before another can proceed. order and removes the stack’s other change sets.
- On replacement, CloudFormation usually creates a new resource, redirects dependents, and removes the old physical resource. A physical IDThe identifier of an actual provisioned resource, which changes when CloudFormation replaces it. identifies the actual provisioned resource.
| Update behavior | Resource effect |
|---|---|
| No interruption | Update without disrupting resource operation |
| Some interruption | Update can disrupt resource operation |
| Replacement | Create a resource with a new physical ID |
Exam cues
- If the question says a database might be replaced, think
ReplacementandRequiresRecreation, because the preview exposes resource and property replacement requirements. - If the question says all child-stack changes need review, think
IncludeNestedStacks, because it previews the hierarchy before root execution. - If the question says an RDS DB instance needs a major upgrade, think
EngineVersionplusAllowMajorVersionUpgrade: true, because one selects the version and the other permits that major change.
Remember
Replacement:True,False, orConditional.RequiresRecreation:Never,Conditionally, orAlways.- A
CREATEchange set leaves the stack inREVIEW_IN_PROGRESSwith no provisioned resources until execution. - For policy, conditionTemplate logic that determines whether a resource is created or a property value applies., or output-only changes that report no updates, add or modify resource
Metadatain the update.
Trap: Passing change set creation checks does not guarantee successful execution. Runtime conditions can still fail.
Trap: Replacement of a custom-named resource requires a new name.
Create a change set without applying resource changes.
Review the preview, then execute the selected change set.
CloudFormation updates resources according to their dependencies.
A configured rollback-trigger alarm can roll back the operation.
Box details (5)
- New template
Submit a changed template or parameter values to create a change set.
- Change set
Review proposed changes and replacement risk. Runtime execution can still fail.
- Stack
Execution applies the changes and removes the other change sets for this stack.
- Resources
Replacement normally creates a new resource, redirects dependents, and removes the old resource.
- CloudWatch alarm
A configured alarm entering ALARM during the operation or monitoring period triggers rollback.
From the AWS docs (17)
- A change set previews proposed resource and stack changes without applying them until execution.
- Change set creation checks common failures including property syntax, resource name conflicts, and service quotas, but runtime execution can still fail.
- After executing a change set, CloudFormation removes the other change sets associated with that stack.
- Resource property update behavior is no interruption, some interruption, or replacement.
- Replacement gives a resource a new physical ID; CloudFormation usually creates the replacement first, redirects dependents, then removes the old resource.
- ResourceChange.Replacement can be True, False, or Conditional.
- ResourceTargetDefinition.RequiresRecreation can be Never, Conditionally, or Always.
- ResourceChange.Scope identifies the changed resource attributes, including Properties and Tags.
- A resource with a custom name cannot be replaced unless a new name is supplied.
- If policy, condition, or output-only changes produce No updates to perform, adding or modifying a resource Metadata attribute can trigger the update.
- IncludeNestedStacks true creates change sets for the full nested hierarchy; execute or delete them through the root change set.
- A CREATE change set creates a stack record with no resources and leaves it in REVIEW_IN_PROGRESS until execution.
- EngineVersion on AWS::RDS::DBInstance specifies the requested database engine version.
- AllowMajorVersionUpgrade must be true when EngineVersion requests a different major RDS DB instance engine version.
- A configured rollback-trigger alarm entering ALARM during an operation or its monitoring window rolls back the entire stack operation.
- CloudFormation orders resource updates by dependency.
- A Lambda function whose code is in S3 is updated by CloudFormation only when S3Bucket, S3Key or S3ObjectVersion changes; uploading new code to the same key leaves the stack with nothing to update.
Deletion and replacement policies
Deletion and replacementAn update that provisions a new physical resource in place of the previous one. policies decide what CloudFormation does with a physical resource when it leaves a stackA group of resources created and managed together from a CloudFormation template.. Choose the policy by the event: removal from the stack or replacement during an update.
How it works
- Set
DeletionPolicyfor stack deletion or removal of a resource definition from the templateA JSON or YAML document that describes the resources CloudFormation should manage.. - Set
UpdateReplacePolicyseparately when an update might replace the resource. Replacement normally creates the new resource and redirects dependents before disposing of the old one. - Select the retention behavior. A snapshotA saved copy of supported resource data created before the resource is deleted. is a saved copy of a resource’s data, available only for supported types.
| Behavior | DeletionPolicy | UpdateReplacePolicy |
|---|---|---|
| Delete the resource | Delete |
Delete |
| Keep the physical resource outside stack management | Retain |
Retain |
| Keep it except on rollbackRecovery that attempts to return a stack to its previous working configuration after a failed operation. of its creating operation | RetainExceptOnCreate |
Not an option |
| Snapshot, then delete | Snapshot on supported types |
Snapshot on supported types |
Exam cues
- If the question says deleting a stack must preserve a database, think
DeletionPolicy, because that policy controls removal from the stack. - If the question says an update replaces a database and its old copy must survive, think
UpdateReplacePolicy, because replacement has a separate disposal policy. - If the question says failed initial provisioning must leave no unused resource, think
RetainExceptOnCreate, because it deletes on rollback of the creating operation.
Remember
DeletionPolicydefaults toDelete, exceptSnapshotfor RDS DBCluster and RDS DBInstance withoutDBClusterIdentifier.UpdateReplacePolicydefaults toDelete.- Retained resources and snapshots can keep incurring charges.
Trap: DeletionPolicy does not cover replacement. UpdateReplacePolicy: Snapshot falls back to Delete when the resource does not support snapshots.
From the AWS docs (12)
- DeletionPolicy applies when a stack is deleted or a resource is removed from its template, but not when an update replaces its physical resource.
- DeletionPolicy defaults to Delete except that RDS DBCluster and RDS DBInstance without DBClusterIdentifier default to Snapshot.
- Delete removes the resource and applicable contents.
- Retain keeps the physical resource while removing it from CloudFormation management when it leaves the stack.
- RetainExceptOnCreate retains a resource except when the operation that initially created it rolls back, when CloudFormation deletes it.
- Snapshot takes a snapshot before deleting a resource that supports this policy.
- UpdateReplacePolicy controls the old physical resource when an update requires replacement.
- UpdateReplacePolicy supports Delete, Retain, and Snapshot, with Delete as its default.
- UpdateReplacePolicy Snapshot falls back to Delete on a resource type without snapshot support.
- Retained resources and snapshots continue to incur applicable charges until deleted.
- Replacement normally creates a new physical resource and redirects dependents before removing the old one.
- A stack can't be renamed; to move resources to a stack with a new name, set DeletionPolicy Retain on them, delete the old stack, then import the retained resources into a new stack.
Creation and deletion failures
CloudFormation events explain which resource operation failed and why. Recovery depends on whether creation failed, rollbackRecovery that attempts to return a stack to its previous working configuration after a failed operation. finished, or deletion left resources behind.
How it works
- Read stackA group of resources created and managed together from a CloudFormation template. events and their status reasons to find the failed resource operation.
- For EC2 bootstrapThe installation and configuration performed to prepare an instance to run its software., inspect the relevant logs. Bootstrap means the software installation and configuration performed as an instance starts.
- If failed creation ends in
ROLLBACK_COMPLETE, delete and recreate the stack. For investigation and resumption, choosePreserve successfully provisioned resourcesbefore the operation, then troubleshoot and retry or update. - For
DELETE_FAILED, fix the blocking resource and retry, retain selected failed resources, or force-delete the stack while leaving undeletable resources and their dependencies.
| Linux log | Diagnose |
|---|---|
/var/log/cfn-init.log |
cfn-init helper activity |
/var/log/cfn-init-cmd.log |
Commands run during bootstrap |
/var/log/cloud-init-output.log |
EC2 user-data script output |
Exam cues
- If the question says a non-empty S3 bucket blocks stack deletion, think empty and retry or retain the bucket, because the bucket contents prevent deletion.
- If the question says a failed initial deployment must be inspected and resumed, think preserve successfully provisioned resources, because automatic rollback would remove the successful creations.
- If the question says
ROLLBACK_COMPLETEafter the first create, think delete and recreate, because that state allows only deletion.
Remember
- Missing delete permission or an in-use security group can also prevent deletion.
FORCE_DELETE_STACKis a recovery option forDELETE_FAILED; resources can remain afterward.- Termination protection defaults to off, applies through the root stack to nested stacks, and rejects deletion without changing stack status.
Trap: Termination protection does not prevent an update from removing a nested stack. A blocked deletion request does not itself put the stack in DELETE_FAILED.
From the AWS docs (12)
- Stack events and their status reasons identify resource provisioning failures.
- ROLLBACK_COMPLETE after failed stack creation permits only stack deletion, so another attempt requires deleting and recreating the stack.
- Preserve successfully provisioned resources leaves successful creations in place and failed creations in CREATE_FAILED for troubleshooting and retry or update.
- cfn-init troubleshooting output on Linux is available in /var/log/cfn-init.log.
- The Linux /var/log/cfn-init-cmd.log file helps diagnose commands run during CloudFormation bootstrap.
- EC2 Linux user-data script output is available in /var/log/cloud-init-output.log.
- A non-empty S3 bucket, a security group still in use, or missing underlying delete permissions can prevent stack resource deletion.
- For DELETE_FAILED, retry deletion after fixing the resource or use RetainResources to leave specified failed resources behind.
- FORCE_DELETE_STACK permits deleting a DELETE_FAILED stack while retaining resources that cannot be deleted and their dependencies.
- Termination protection blocks stack deletion and is disabled by default; a blocked delete leaves the stack status unchanged.
- Termination protection is controlled on the root stack and passed to its nested stacks, but does not prevent an update from removing a nested stack.
- Every stack operation gets an operation ID; stack events are grouped by it, and describe-events can filter one operation to failed events only (FailedEvents=true) to find the failing resource.
Service roles and capabilities
A CloudFormation service roleAn IAM role that CloudFormation assumes to perform resource operations on behalf of a stack. defines which AWS resource actions CloudFormation can perform for a stackA group of resources created and managed together from a CloudFormation template.. Capabilities are separate acknowledgments that a templateA JSON or YAML document that describes the resources CloudFormation should manage. can create IAM resources or expand macrosA Lambda-backed processor that rewrites template content before CloudFormation provisions resources..
How it works
- Create an IAM role that trusts
cloudformation.amazonaws.comand grants only the resource actions the stack needs. A trust policyA role policy that specifies which principals can assume that role. defines who can assume a role. - Specify that role when operating the stack, with
iam:PassRolepermission. CloudFormation then uses the role’s credentials. - Acknowledge the template capabilities that apply before creation.
| CapabilityAn explicit acknowledgment that a template can affect IAM resources or expand macros. | Meaning |
|---|---|
CAPABILITY_IAM |
Acknowledge IAM resources without custom names |
CAPABILITY_NAMED_IAM |
Acknowledge IAM resources, including custom-named ones |
CAPABILITY_AUTO_EXPAND |
Acknowledge direct macro expansion without reviewing a change setA preview of proposed stack changes that must be executed before CloudFormation applies them. first |
Exam cues
- If the question says custom IAM names cause
InsufficientCapabilities, thinkCAPABILITY_NAMED_IAM, because the template needs that acknowledgment. - If the question says directly create a stack containing macros, think
CAPABILITY_AUTO_EXPAND, because template processing can add resources before provisioning. - If the question says operators gain unexpected resource access through a stack, think the service role’s permissions, because stack operations can use that attached role.
Remember
- Without a service role, CloudFormation normally uses a temporary session based on the caller’s credentials.
- Once attached, the role applies to all stack operations. It can be changed but cannot be removed.
- Review processed change sets for macros that may introduce IAM resources.
Trap: iam:PassRole is required to specify the role, but another user allowed to operate the stack can use its existing attached role without that permission.
From the AWS docs (9)
- A CloudFormation service role supplies credentials for stack resource operations instead of the caller-derived temporary session used by default.
- A CloudFormation service role trusts cloudformation.amazonaws.com to assume it.
- Specifying a CloudFormation service role requires iam:PassRole permission for that role.
- Once attached, a service role is used for all stack operations and cannot be removed, although it can be changed.
- Other users allowed to operate a stack can use its attached service role without having iam:PassRole, so the role should grant least privilege.
- Templates containing IAM resources require CAPABILITY_IAM or CAPABILITY_NAMED_IAM acknowledgment; custom IAM names require CAPABILITY_NAMED_IAM.
- Omitting required IAM capability acknowledgment produces InsufficientCapabilities.
- CAPABILITY_AUTO_EXPAND acknowledges macro processing when directly creating a stack without first reviewing a change set.
- AWS recommends reviewing a macro-processed change set because macros can add resources, including IAM resources.
Nested stacks
Nested stacksA group of resources created and managed together from a CloudFormation template. reuse a CloudFormation templateA JSON or YAML document that describes the resources CloudFormation should manage. as a child of another stack. They let a root stack manage a hierarchy while passing inputs and outputs between reusable pieces.
How it works
- Store the child template in S3 and reference it with
TemplateURLon anAWS::CloudFormation::Stackresource. - Pass child inputs through that resource’s
Parametersproperty. - Read child results with
Fn::GetAtt Child.Outputs.OutputName. The parent can pass one child’s result into another child’s parametersA typed input supplied to customize a stack when it is created or updated.. - Initiate updates and deletion through the root stack. The root is the top of the hierarchy; a parent is the immediate stack containing a child. CloudFormation updates the nested stacks that need changes.
Exam cues
- If the question says reuse a template inside a stack hierarchy, think a nested stack, because
AWS::CloudFormation::Stackreferences the reusable child template. - If the question says one nested stack needs another child’s output, think parent wiring with
GetAttandParameters, because child outputs can become sibling inputs.
Remember
TemplateURLpoints to the child template in S3.- Update the hierarchy from its root rather than operating on child stacks directly.
Trap: A child output is read from the nested stack resource using Outputs.OutputName. Passing the child resource’s identifying value is not the same as reading that output.
Read the network child output in the parent template.
Pass the output as an input to the application child.
Box details (3)
- Network child
The child exposes its value in Outputs.
- Parent stack
GetAtt reads Child.Outputs.OutputName.
- Application child
The parent supplies the value through the child Parameters property.
From the AWS docs (9)
- An AWS::CloudFormation::Stack resource creates a nested stack from another template for reuse within a stack hierarchy.
- The root stack is the top of a nested hierarchy; each nested stack also has an immediate parent.
- AWS recommends initiating updates from the root stack; CloudFormation updates only nested stacks with template changes and does not recommend direct child updates.
- TemplateURL on AWS::CloudFormation::Stack identifies the nested stack template stored in Amazon S3.
- The Parameters property of AWS::CloudFormation::Stack passes input key-value pairs to the child template.
- Fn::GetAtt on a nested stack resource with Outputs.OutputName returns that child output.
- A parent can pass an output from one nested stack as an input to another nested stack in its group.
- Root-stack operations should manage nested stacks rather than deleting child stacks directly.
- One template can declare up to 500 resources, and one operation in a nested stack hierarchy can create, update or delete at most 2,500 resources, though the hierarchy may hold more.
Cross-stack exports
Cross-stack exportsA named stack output made available to importing stacks in the same account and Region. share values between independently managed CloudFormation stacksA group of resources created and managed together from a CloudFormation template. in the same account and Region. An import also protects its source from deletion while consumers depend on the exported value.
How it works
- Define an output in the producing stack and give it an
Exportname unique within the account and Region. - Use
Fn::ImportValuewith that name in a consuming stack in the same account and Region. - To change the export value or delete the producer, find consumers with
list-importsand remove all imports first.
Exam cues
- If the question says independent application stacks share a network identifier in one account and Region, think exports and
Fn::ImportValue, because they share outputs across separate stack lifecycles. - If the question says deletion of an exporting stack is blocked, think remaining imports, because consumers lock the exported value and its producing stack.
Remember
- Export names are unique per account and Region.
- Export names and import expressions cannot depend on resource-dependent
ReforGetAttvalues. - Nested stacks compose a hierarchy managed from one root; exports connect independent stacks.
Trap: An imported value cannot be changed while consumers still import it. Remove every import before changing that value or deleting the source stack.
From the AWS docs (7)
- Outputs.Export publishes a value that another stack reads with Fn::ImportValue.
- Fn::ImportValue works only within the same AWS account and Region.
- Export names must be unique within an account and Region.
- An imported export value cannot be modified and its producing stack cannot be deleted until all imports are removed.
- Export names and ImportValue expressions cannot depend on resource-dependent Ref or GetAtt values.
- Exports support independently managed stacks, while nested stacks compose resources under one root hierarchy.
- The list-imports operation identifies stacks importing a specified export.
Bootstrap helpers and signals
CloudFormation bootstrapThe installation and configuration performed to prepare an instance to run its software. helpers configure EC2 software, while signals report whether setup succeeded. A CreationPolicy makes that report part of resource creation, so a provisioned instance is not accepted as ready before its setup finishes.
How it works
- Ensure the instance image contains the helpers or install
aws-cfn-bootstrap. Call the helpers explicitly from bootstrap, typically EC2 user dataInstructions supplied to an EC2 instance to run tasks when it starts..Fn::Base64encodes the user-data string. - Call
cfn-initto applyAWS::CloudFormation::InitmetadataAdditional information attached to a template or resource, including configuration read by helper scripts.. A configsetAn ordered list of configuration keys that cfn-init should process., an ordered list of configuration keys, controls multiple phases throughconfigSets. - After configuration succeeds or fails, report the result with
cfn-signalorSignalResource. ACreationPolicywaits for the required successes and fails creation on a failure signal or timeout. - For later metadata changes, configure
cfn-hupto run an action such as callingcfn-initagain.
| Helper | Purpose |
|---|---|
cfn-init |
Apply packages, users, groups, archives, files, commands, and services from metadata |
cfn-signal |
Report readiness or failure |
cfn-hup |
Detect metadata changes and run configured actions |
Within each config key, the order is packages, groups, users, sources, files, commands, then services. sources downloads and unpacks an archive. Use separate config keys in a configset when a different overall order is needed.
Exam cues
- If the question says wait for EC2 application setup, think
CreationPolicypluscfn-signal, because instance provisioning alone does not report software readiness. - If the question says apply changed metadata to a running instance, think
cfn-hup, because metadata updates do not invokecfn-initautomatically. - If the question says coordinate installation phases, think
configSets, because it orders configuration keys.
Remember
ResourceSignal.Countdefaults to 1;Timeoutdefaults toPT5M, maximum 12 hours, starting after stabilization.- CreationPolicy supports EC2 Instance, Auto Scaling AutoScalingGroup, CloudFormation WaitCondition, and AppStream Fleet.
- Auto Scaling creation success percentage defaults to 100.
- Without a selected configset,
cfn-initlooks for a key namedconfig.
Trap: A WaitConditionHandle uses a presigned S3 URL, which is a URL authorized for a specific request. The sender needs S3 reachability. A WaitCondition using CreationPolicy can instead use SignalResource. Keep the two signaling paths separate.
Run cfn-init on the instance to apply its metadata.
Send the setup result so CreationPolicy can complete or fail resource creation.
Box details (3)
- Init metadata
Define configuration keys and their configSets order.
- EC2 instance
User data calls cfn-init to apply the metadata.
- CreationPolicy
cfn-signal reports the result. Creation waits for the required success signals.
From the AWS docs (17)
- CloudFormation helper scripts must be explicitly called; install aws-cfn-bootstrap if the selected image does not include the helpers.
- cfn-init reads AWS::CloudFormation::Init metadata and applies packages, files, commands, and services.
- AWS::CloudFormation::Init can create operating-system users and groups and download and unpack archives using sources.
- Within a config key, cfn-init processes packages, groups, users, sources, files, commands, and services in that order.
- configSets orders multiple cfn-init config keys; without a selected configset, cfn-init looks for a config key named config.
- cfn-init is typically called from EC2 user data; Fn::Base64 encodes a string for the UserData property.
- CreationPolicy prevents create completion until the required success signals arrive; cfn-signal or SignalResource sends those signals.
- CreationPolicy ResourceSignal.Count defaults to 1.
- CreationPolicy ResourceSignal.Timeout defaults to PT5M and allows up to 12 hours; its timer starts after resource stabilization.
- A failure signal or too few success signals before timeout fails resource creation and triggers stack rollback.
- CreationPolicy is supported by AWS::EC2::Instance, AWS::AutoScaling::AutoScalingGroup, AWS::CloudFormation::WaitCondition, and AWS::AppStream::Fleet.
- AutoScalingCreationPolicy.MinSuccessfulInstancesPercent defaults to 100.
- cfn-hup checks for metadata changes and runs configured actions; changing metadata alone does not run cfn-init.
- A WaitConditionHandle provides a presigned S3 URL for wait-condition signals, so the signal sender needs access to the CloudFormation-specific S3 bucket.
- A WaitCondition configured with CreationPolicy can receive signals through SignalResource instead of a wait-condition handle.
- AWS recommends CreationPolicy with cfn-signal rather than a separate wait condition for EC2 and Auto Scaling bootstrap readiness.
- cfn-hup checks resource metadata for changes every 15 minutes by default; the interval setting in cfn-hup.conf changes it.
Update rollback recovery
Update rollbackRecovery that attempts to return a stack to its previous working configuration after a failed operation. tries to return a CloudFormation stackA group of resources created and managed together from a CloudFormation template. to its previous working state. If that recovery fails, the stack enters UPDATE_ROLLBACK_FAILED and needs repair before another update.
How it works
- Inspect the rollback failure reason. External deletion, permissions, limits, or missing signals can stop recovery.
- Fix the cause and choose
Continue update rollbackto reachUPDATE_ROLLBACK_COMPLETE. - If the cause cannot be fixed, skip the minimum required rollback-failing resources. For a nested resource, use
NestedStackName.ResourceLogicalID. Alternatively,force-rollbackskips rollback failures across the hierarchy. - Reconcile skipped resources with the templateA JSON or YAML document that describes the resources CloudFormation should manage. before attempting another update. Their
UPDATE_COMPLETEstatus does not prove their configuration matches.
Exam cues
- If the question says an update rollback is stuck, think fix the cause and continue update rollback, because
UPDATE_ROLLBACK_FAILEDblocks further updates. - If the question says only one nested resource cannot roll back, think a targeted
ResourcesToSkipentry, because the list can identify that child resource. - If the question says run automation after a successful update, think an EventBridge rule on the stack status event, because its status field identifies completion.
Remember
- Skip resources that failed during rollback, not merely during the forward update.
force-rollbackandresources-to-skipare mutually exclusive.- Successful-update events use source
aws.cloudformation, detail-typeCloudFormation Stack Status Change, anddetail.status-details.status: UPDATE_COMPLETE.
Trap: Skipping a resource completes control-plane recovery but can leave its real configuration inconsistent with the template. Repair that inconsistency before another update.
From the AWS docs (10)
- UPDATE_ROLLBACK_FAILED means CloudFormation could not finish rolling back an update and cannot accept another stack update.
- Fix the rollback failure and use Continue update rollback to reach UPDATE_ROLLBACK_COMPLETE before retrying updates.
- Resources changed or deleted outside CloudFormation, insufficient permissions, limits, and missing signals can prevent update rollback.
- ResourcesToSkip should contain the minimum necessary resources that failed during rollback, not during the forward update.
- Skipped rollback resources are marked UPDATE_COMPLETE but can differ from the template and must be reconciled before another update.
- The continue-update-rollback force-rollback option skips rollback-failing resources across the stack hierarchy.
- force-rollback and resources-to-skip cannot be used in the same request.
- A skipped resource inside a nested stack uses NestedStackName.ResourceLogicalID in ResourcesToSkip.
- CloudFormation Stack Status Change events use source aws.cloudformation and report the stack status in detail.status-details.status.
- UPDATE_COMPLETE is the stack status for a successful update.
Alarm rollback triggers
RollbackRecovery that attempts to return a stack to its previous working configuration after a failed operation. triggers connect CloudFormation deployment recovery to CloudWatch alarms. They let application behavior stop an operation even when resource provisioning itself has succeeded.
How it works
- Configure alarm ARNs as rollback triggers. An ARNAn identifier that uniquely names an AWS resource. is the AWS identifier for a resource. Both metric alarms and composite alarms are supported; a composite alarm combines alarm states.
- CloudFormation monitors the alarms during stackA group of resources created and managed together from a CloudFormation template. creation or updating and for the configured period after resources deploy.
- If an alarm enters
ALARM, CloudFormation rolls back the whole operation. If the period ends successfully during an update, it cleans up old resources.
Exam cues
- If the question says application errors rise after resources deploy, think rollback triggers with a monitoring window, because the alarms remain active after resource deployment.
- If the question says missing metrics must stop deployment, think treating missing alarm data as breaching, because
INSUFFICIENT_DATAalone does not trigger rollback.
Remember
- Maximum: 5 rollback triggers.
- API monitoring period: 0 to 180 minutes, default 0.
- Zero still monitors alarms during the operation.
- A missing alarm makes the operation fail and roll back.
- Triggers are not monitored while an update rolls back.
Trap: A zero-minute monitoring period disables only the additional wait after deployment. It does not disable alarms during provisioning.
From the AWS docs (9)
- Rollback triggers roll back a whole stack create or update operation if a configured alarm enters ALARM during the operation or monitoring period.
- A stack can have up to 5 rollback triggers, identified by CloudWatch alarm ARNs.
- Rollback triggers support AWS::CloudWatch::Alarm and AWS::CloudWatch::CompositeAlarm.
- MonitoringTimeInMinutes ranges from 0 to 180 and defaults to 0 in the API.
- A monitoring time of 0 still monitors triggers during stack creation or updating.
- For an update, CloudFormation waits until the monitoring period ends before cleaning up old resources.
- INSUFFICIENT_DATA alone does not trigger rollback; configure the alarm to treat missing data as breaching if missing metrics should cause an alarm.
- A missing rollback-trigger alarm causes the stack operation to fail and roll back.
- CloudFormation does not monitor rollback triggers while rolling back an update.
Drift detection and remediation
DriftA difference between a resource actual configuration and its expected template and parameter configuration. is the difference between a resource’s live configuration and its expected CloudFormation configuration. Drift detection finds those differences; remediation changes the resource or adopts the live settings in the templateA JSON or YAML document that describes the resources CloudFormation should manage..
How it works
- Run stackA group of resources created and managed together from a CloudFormation template. drift detection. CloudFormation reads supported resources and compares explicitly configured properties with expected template and parameterA typed input supplied to customize a stack when it is created or updated. values.
- Inspect resource results and the overall stack status. Run separate checks for nested stacks. For a StackSet, run StackSet drift detection to aggregate member-stack results, including parameter overrides.
- Restore the intended configuration or update the template to accept the live state. A drift-aware change setA preview of proposed stack changes that must be executed before CloudFormation applies them. with
REVERT_DRIFTpreviews actual, previous, and desired states before reconciling supported properties. - If accepting a live setting would require replacementAn update that provisions a new physical resource in place of the previous one., use the import path for an import-supported resource: set
DeletionPolicy: Retain, remove the resource in a stack update, then import it using a definition matching its actual state.
The caller needs cloudformation:DetectStackDrift, cloudformation:DetectStackResourceDrift,
cloudformation:BatchDescribeTypeConfigurations, and resource read permissions such as
ec2:DescribeInstances. DetectStackDrift returns an operation ID; monitor it with
DescribeStackDriftDetectionStatus and retrieve differences with DescribeStackResourceDrifts.
| Result applies to | Status | Meaning |
|---|---|---|
| Resource | IN_SYNC |
Checked configuration matches |
| Resource | MODIFIED |
Checked configuration differs |
| Resource | DELETED |
Resource no longer exists |
| Resource or stack | NOT_CHECKED |
No applicable drift check result |
| Stack | DRIFTED |
At least one resource differs |
| Stack | IN_SYNC |
Supported checked resources match |
Exam cues
- If the question says recurring compliance checks must find drift, think Config rule
cloudformation-stack-drift-detection-check, because it runs detection on configuration changes and periodically. - If the question says route a drift result to automation, think EventBridge matching
CloudFormation Drift Detection Status Change, because the event containsdetail.stack-drift-status. - If the question says preserve an accepted live change that would otherwise replace a resource, think retain, remove, and import, because import can adopt the existing resource.
- If security group attachments are in another stack, interpret drift results carefully because CloudFormation cannot analyze cross-stack attachments.
- If an AWS Config drift rule times out, split stacks into tagged groups and scope separate rule instances.
- If executing a drift-aware change set, review cross-stack attachments: it can revert them. It preserves unchanged AWS-managed properties and external tagA key-value label attached to a resource for organization or cost tracking. keys absent from the template.
- If the question says a Config remediation should redeploy a stack from a template in S3, think the AWS-UpdateCloudFormationStack runbook, because it updates the stack from that template URL.
Remember
- Unspecified defaults and unreadable properties such as passwords are outside detection coverage.
KMSKeyIdproperties and Lambda source code are not checked. A stack with no supported resources can still reportIN_SYNC.- Event source:
aws.cloudformation. Adrifted-stack-resource-countof -1 means detection is still running. - Drift-aware change sets cannot reconcile immutable properties, which are properties requiring replacement. Unsupported types and write-only values use previous deployment values for comparison.
- A failed drift-aware deployment rolls back to actual pre-deployment state.
Trap: A StackSet member updated directly through CloudFormation can differ from the StackSet template without being drifted. Detection uses that member stack’s own expected template and parameters.
Retain and remove the resource from stack management without deleting it.
Import the existing resource using a template matching its live state.
Box details (3)
- Retain resource
Set DeletionPolicy: Retain before removing the resource definition.
- Remove from stack
Update the stack without the retained resource definition.
- Import resource
Import the same physical resource using its actual configuration; the type must support import.
From the AWS docs (28)
- Drift is a difference between a resource actual configuration and the expected template and parameter configuration.
- Drift detection compares only supported resources and properties explicitly set in the template, including values supplied through parameters.
- Drift detection on a parent stack does not inspect nested stacks; run detection on each nested stack.
- Drift detection cannot compare values the resource service does not return, such as passwords.
- Resource drift status is IN_SYNC, MODIFIED, DELETED, or NOT_CHECKED.
- Stack drift status is IN_SYNC, DRIFTED, or NOT_CHECKED; one drifted resource makes the stack DRIFTED.
- Drift detection reports differences; corrective action is needed to change resource configuration.
- To accept live changes without replacement on an import-supported resource, retain it, remove it from the stack, then import it with a template matching its actual state.
- The Config rule cloudformation-stack-drift-detection-check performs drift detection on configuration changes and periodically, and reports DRIFTED stacks NON_COMPLIANT.
- CloudFormation Drift Detection Status Change events use source aws.cloudformation and detail.stack-drift-status to report stack drift.
- The drift status event reports drifted-stack-resource-count as -1 while detection is in progress.
- StackSet drift detection checks each associated stack, accounts for parameter overrides, and marks the StackSet DRIFTED if any instance drifts.
- A direct CloudFormation update to a StackSet member stack is not itself drift when resources still match that stack own template and parameters.
- A drift-aware change set uses deployment mode REVERT_DRIFT to compare actual, previous, and desired states and reconcile supported drift on execution.
- Drift-aware change sets cannot reconcile immutable properties and use previous deployment values for unsupported types and write-only properties.
- Updating a template to match actual state lets a drift-aware change set reset drift status without modifying that resource.
- Drift detection requires CloudFormation detection and type configuration permissions plus read permissions for supported resources, such as ec2:DescribeInstances.
- CloudFormation drift detection does not check KMSKeyId properties or compare Lambda function source code to its template Code property.
- A stack with no resources supporting drift detection can still report IN_SYNC.
- Drift results for resource attachments across stacks can be inaccurate because CloudFormation cannot analyze attachments across stacks.
- DetectStackDrift returns an operation ID; DescribeStackDriftDetectionStatus monitors progress and DescribeStackResourceDrifts returns resource results.
- A failed drift-aware deployment rolls resources back to their actual pre-deployment state.
- Drift-aware change sets leave AWS-managed property values unchanged when the template does not modify them, and do not remove or modify tag keys absent from the template.
- Drift-aware change sets can detect and revert attachments made by resources in another stack.
- The AWS Config drift detection rule has a 15-minute execution limit; AWS suggests dividing stacks by tags and using separately scoped rule instances if it times out.
- The AWS-UpdateCloudFormationStack Automation runbook updates an existing stack from a template stored in S3. It takes the stack name or ID, the template URL and a role for its Lambda step.
- Resources whose type doesn't support drift detection get a drift status of NOT_CHECKED.
- The Config rule cloudformation-stack-drift-detection-check runs DetectStackDrift on every stack and is limited to 15 minutes, so in large accounts scope it to fewer stacks with tags.
Cross-account and Region outputs
Fn::GetStackOutput reads another CloudFormation stackA group of resources created and managed together from a CloudFormation template.’s output across accounts or Regions without an exportA named stack output made available to importing stacks in the same account and Region.. Treat it as a lookup during deployment: later source changes do not flow automatically to its consumers.
How it works
- Specify
StackNameandOutputName, the logical IDA name used to identify and reference a resource within its template. of the output in the source templateA JSON or YAML document that describes the resources CloudFormation should manage.. - Set
Regionfor a source in another Region. For another account, setRoleArnto a role in the source account. - Give that role
cloudformation:DescribeStackspermission and trust allowing the consumer’s execution role to assume it. CloudFormation reads the value when creating or updating the consumer.
Exam cues
- If the question says read another account’s stack output, think
Fn::GetStackOutputwith a source role, because the function supports cross-account lookup. - If the question says prevent deletion of a local output’s producing stack, think
ExportandFn::ImportValue, becauseGetStackOutputhas a weak referenceAn output lookup that neither prevents source changes or deletion nor automatically updates consumers. that does not enforce that protection.
Remember
Regiondefaults to the consumer’s Region.RoleArndefaults to its execution role.- Cross-partition lookup is unsupported. A partitionA separate group of AWS Regions, such as standard AWS Regions or AWS GovCloud Regions. is a separate AWS group of Regions, such as the standard AWS partition and AWS GovCloud.
- May 2026: AWS announced native
Fn::GetStackOutputsupport across accounts and Regions. - Current unsupported positions include a direct
Outputsvalue, aSubvariable map,Base64,Equalsin ConditionsTemplate logic that determines whether a resource is created or a property value applies., andImportValue.
Trap: A weak reference does not block source deletion or notify the consumer of changes. Re-resolve the lookup with a consumer operation when a new value is needed.
Assume the source-account role specified by RoleArn.
Read the source stack output with cloudformation:DescribeStacks.
Box details (3)
- Consumer stack
GetStackOutput resolves a source output during stack creation or updating.
- Source IAM role
RoleArn identifies a role assumable by the consumer execution role with DescribeStacks permission.
- Source stack
StackName, OutputName, and Region select the output to read. An Export is not required.
From the AWS docs (10)
- Fn::GetStackOutput reads an output from another stack, including across accounts and Regions, without requiring an Export.
- Fn::GetStackOutput requires StackName and OutputName, where OutputName is the output logical ID.
- The Region parameter chooses the source Region and defaults to the consuming stack Region.
- For cross-account reads, RoleArn identifies a source-account role with cloudformation:DescribeStacks that the consuming stack execution role can assume.
- RoleArn defaults to the current stack execution role when omitted.
- GetStackOutput resolves at create or update time; later source edits or deletion neither update nor notify the consumer and are not blocked by the reference.
- GetStackOutput does not support references across AWS partitions.
- Fn::ImportValue requires an export in the same account and Region and blocks deletion of its imported source.
- Fn::GetStackOutput support was announced in May 2026.
- GetStackOutput is unsupported as a direct Outputs value or inside Sub variable maps, Base64, Equals in Conditions, or ImportValue.
StackSet permissions and targeting
StackSets deploy a CloudFormation templateA JSON or YAML document that describes the resources CloudFormation should manage. as separate stacksA group of resources created and managed together from a CloudFormation template. across accounts and Regions. A stack instanceAn association between a StackSet and a target account and Region. is the association between the StackSet and one target account and Region.
How it works
- Select a permission model and configure its prerequisites.
- Select accounts and Regions. With service-managed permissions, target an organization or organizational unitA group of AWS Organizations accounts that can be selected as a deployment target. (OU), a group of accounts; child OUs are included.
- Enable automatic deployment to add stacks as accounts join the target. Choose retention or deletion when accounts leave.
- Override template parameterA typed input supplied to customize a stack when it is created or updated. values for selected account and Region combinations when they need different settings. Later StackSet updates preserve those overrides.
| Model | Permissions | Target management |
|---|---|---|
| Self-managed | Administrator and execution roles with cross-account trust | Select accounts and Regions |
| Service-managed | Organizations trusted accessAn Organizations integration that lets a service perform supported actions in organization accounts.; StackSets creates roles | Organization or OUs, with optional automatic deployment |
Exam cues
- If the question says apply a baseline to new OU accounts automatically, think a service-managed StackSet with automatic deployment, because account membership drives new stack instances.
- If the question says one account needs a different template input, think a stack-instance parameter overrideA stack-instance parameter value that takes precedence over the StackSet value for selected targets., because the template can remain shared.
- If the question says include the management account in an organization rollout, think a separate deployment for it, because service-managed StackSets exclude that account.
Remember
- A delegated administratorA member account authorized to initiate supported organization-wide service operations. can initiate service-managed operations; the management account performs them.
- Service-managed StackSets do not support nested stacks, macrosA Lambda-backed processor that rewrites template content before CloudFormation provisions resources., or transformsA template instruction that invokes processing on all or part of a template., including
AWS::Serverless. - Overrides applied to existing OU members do not carry to future members; they receive StackSet defaults.
Trap: Targeting the whole organization still excludes the management account. Automatic deployment does not remove that exclusion.
Create a stack instance in a selected member account and Region.
Deploy the same template to the other selected account and Region targets.
With automatic deployment, account membership changes cause subsequent deployments or removals.
Box details (4)
- StackSet
Trusted access lets StackSets create roles. A delegated administrator can initiate operations performed by the management account.
- AWS Organizations
Automatic deployment adds instances for new target members. Account removal can retain or delete their stacks.
- Member account A
A stack instance associates the StackSet with one target account and Region.
- Member account B
Service-managed deployment excludes the management account.
From the AWS docs (13)
- A StackSet deploys one template as stacks across selected AWS accounts and Regions; a stack instance associates it with an account and Region.
- Self-managed StackSets require administrator and execution IAM roles with a trust relationship between accounts.
- Service-managed StackSets create the needed roles for accounts managed in AWS Organizations and require trusted access.
- Service-managed StackSets can target the organization or OUs, including child OUs.
- An organizational unit is a group of AWS Organizations accounts that can be targeted together.
- Automatic deployment creates StackSet instances for accounts added to the targeted organization or OUs.
- Automatic deployment settings choose whether to retain or delete stacks when accounts leave the targeted organization or OUs.
- Service-managed StackSets do not deploy stack instances into the organization management account.
- The management account or a delegated administrator can initiate service-managed StackSet operations, but operations are performed by the management account.
- Service-managed StackSets do not support nested stacks or templates containing macros or transforms.
- AWS::Serverless is a CloudFormation-hosted transform that expands SAM syntax into a CloudFormation template.
- StackSet parameter values can be overridden for selected accounts and Regions; later StackSet updates preserve those overrides.
- Parameter overrides applied to current target OU members do not apply to future members, which receive StackSet defaults.
StackSet rollout and recovery
StackSet operation preferences control how widely a CloudFormation change runs at once and how many failures it tolerates. Recovery starts with each account and Region result, because an overall operation status can hide tolerated failures.
How it works
- Choose Region order and concurrencyThe number of target operations allowed to run at the same time..
Sequentialis the default;Paralleloperates across Regions simultaneously. - Limit concurrent accounts and set failure toleranceThe number or percentage of stack-instance operation failures allowed per Region before a StackSet operation stops. per Region. Strict mode reduces actual concurrency as failures occur, staying within tolerance plus one; soft mode keeps the requested account concurrency.
- Inspect operation results and per-instance status reasons.
FailedStackInstancesCountcan reveal failures even when the operation isSUCCEEDED. - Fix the reported cause and retry the affected targets with the current templateA JSON or YAML document that describes the resources CloudFormation should manage.. When detaching stacksA group of resources created and managed together from a CloudFormation template. is intended, use
Retain stacksto leave them running outside StackSet management.
Check whether the target account has reached a resource quota or whether a global resource name, such as an S3 bucket name, is already in use.
| Instance status | Meaning | Recovery |
|---|---|---|
OUTDATED |
Not current after a failed operation or one stopped before reaching it | Inspect the reason, fix, and retry |
INOPERABLE |
Failed deletion left an unstable instance | May require detach with retention and manual cleanup |
| Retained stack | Removed from StackSet management | Manage the remaining stack in its target account |
Exam cues
- If the question says some accounts failed but the operation succeeded, think tolerated failures, because failure tolerance can allow
SUCCEEDEDwith failed instances. - If the question says preserve resources while removing StackSet membership, think
Retain stacks, because it detaches the stacks instead of deleting them. - If the question says concurrency must fall after failures, think strict failure tolerance, because it adjusts the account concurrency level.
- If the question says a target account cannot create more roles or a bucket name is already taken, think quota or global name collision, because either can fail a stack operation.
Remember
- Failure tolerance and account concurrency apply per Region.
- Exceeding tolerance stops the operation and prevents progression to remaining Regions.
- Use
list-stack-set-operation-resultsfor per-account results, orlist-stack-instancesfiltersDETAILED_STATUSandLAST_OPERATION_ID. - Remove all instances before deleting the StackSet.
Trap: OUTDATED describes StackSet deployment currency. It does not mean the resources were changed outside CloudFormation.
From the AWS docs (16)
- StackSet Region concurrency defaults to Sequential; Parallel can operate across Regions simultaneously.
- Maximum concurrent accounts limits simultaneous target-account operations within a Region.
- Failure tolerance counts allowed failures per Region; exceeding it stops the operation and prevents progression to remaining Regions.
- Strict failure tolerance reduces actual account concurrency as failures occur and caps it at failure tolerance plus one.
- Soft failure tolerance keeps the specified account concurrency despite failures.
- OUTDATED means a stack is not current because a create or update failed, or its StackSet operation failed or stopped before reaching that stack.
- INOPERABLE can follow a failed stack-instance deletion and excludes the instance from later StackSet updates.
- An INOPERABLE instance can require deletion with RetainStacks true, followed by manual cleanup of the detached stack.
- A StackSet operation can report SUCCEEDED while some instances failed within its failure tolerance.
- list-stack-set-operation-results gives per-account status reasons; list-stack-instances supports DETAILED_STATUS and LAST_OPERATION_ID filters.
- A StackSet stack operation can fail when a target account has reached the quota for a resource the template creates.
- A StackSet stack operation can fail when the template tries to create a global resource such as an S3 bucket with a name that is not unique.
- FailedStackInstancesCount reports instance failures even when a StackSet operation reports SUCCEEDED.
- After fixing a StackSet failure, retry a create or update operation with the current template and target the affected accounts and Regions.
- Retain stacks removes stack instances from StackSet management while leaving the stacks and their resources running in target accounts.
- Delete all stack instances before deleting the StackSet itself.
Auto Scaling update policies
CloudFormation Auto Scaling update policies control how instances change when a stackA group of resources created and managed together from a CloudFormation template. update changes the group’s configuration. Choose batches within the existing group, replacementAn update that provisions a new physical resource in place of the previous one. of the whole group, or an Auto Scaling instance refresh.
How it works
- Choose the update policy for the required replacement behavior.
- For rolling updates, set batch size and the minimum instances to keep in service. Enable
WaitOnResourceSignalsto require readiness reports after application setup. - With signal waiting enabled,
PauseTimeis the deadline for the required signals. Suspend Auto Scaling processes that could interfere with the rolling operation. - If the update rolls back, CloudFormation uses the previous update policy. Apply policy changes separately before the change that triggers replacement.
| Policy | Mechanism | Readiness control |
|---|---|---|
AutoScalingRollingUpdate |
Replace batches inside the same group | WaitOnResourceSignals and PauseTime |
AutoScalingReplacingUpdate |
With WillReplace: true, create a new group and keep the old one until success |
Matching CreationPolicy |
AutoScalingInstanceRefresh |
Use Auto Scaling refresh features, including instance maintenance policies | Use this when the group maintenance policy must be honored |
Exam cues
- If the question says wait for application setup between replacement batches, think rolling updates with resource signalsA success or failure report used by CloudFormation to coordinate resource readiness., because a batch must meet its signal requirement before progress.
- If the question says rollbackRecovery that attempts to return a stack to its previous working configuration after a failed operation. uses an unexpectedly small batch, think the previous update policy, because the failed update’s policy does not govern rollback.
- If the question says preserve an instance maintenance policy, think
AutoScalingInstanceRefresh, because CloudFormation rolling updates do not honor that policy.
Remember
- Rolling defaults:
MaxBatchSize: 1,MinInstancesInService: 0,WaitOnResourceSignals: false. MaxBatchSizemaximum: 100.MinInstancesInServicemust be below groupMaxSize.MinSuccessfulInstancesPercentdefaults to 100; specifying it requires signal waiting.- With signals enabled,
PauseTimedefaults toPT5M; maximumPT1H. Without signals, it has no default. - AWS’s rolling-update example suspends
HealthCheck,ReplaceUnhealthy,AZRebalance,AlarmNotification,ScheduledActions, andInstanceRefresh.
Trap: WillReplace true takes precedence over a rolling policy. AutoScalingInstanceRefresh and AutoScalingRollingUpdate cannot both be set on the same group.
Apply the rolling replacement settings to the group update.
Replace a batch and wait for its required signals before proceeding.
Box details (3)
- Rolling policy
UpdatePolicy chooses batch size, in-service capacity, and signal waiting.
- Auto Scaling group
Replace instances in batches inside the existing group.
- New instances
When WaitOnResourceSignals is true, report setup success within PauseTime.
From the AWS docs (14)
- AutoScalingRollingUpdate replaces instances in batches within the existing Auto Scaling group for supported property changes.
- Rolling MaxBatchSize defaults to 1 and has a maximum of 100.
- Rolling MinInstancesInService defaults to 0 and must be less than the group MaxSize.
- Rolling WaitOnResourceSignals defaults to false.
- Rolling MinSuccessfulInstancesPercent defaults to 100 and requires WaitOnResourceSignals true when specified.
- Rolling PauseTime has a maximum of PT1H and defaults to PT5M when WaitOnResourceSignals is true; otherwise it has no default.
- With WaitOnResourceSignals true, PauseTime is the success-signal timeout and missing required signals fails the update.
- Rollback uses the UpdatePolicy from before the failed update; AWS recommends a separate update for policy changes before triggering replacements.
- AWS recommends suspending interfering Auto Scaling processes during rolling updates; its example suspends HealthCheck, ReplaceUnhealthy, AZRebalance, AlarmNotification, ScheduledActions, and InstanceRefresh.
- AutoScalingReplacingUpdate with WillReplace true creates a new group, retains the old group during creation, and deletes it after successful replacement.
- A replacing update should have a matching CreationPolicy; insufficient creation success signals cause rollback to the old group.
- When both rolling and replacing policies are present, WillReplace true gives the replacing policy precedence.
- AutoScalingInstanceRefresh supports Auto Scaling instance maintenance policies, while CloudFormation rolling updates do not honor them.
- AutoScalingInstanceRefresh and AutoScalingRollingUpdate cannot both be specified on the same group.
Custom resources
A custom resource lets a CloudFormation templateA JSON or YAML document that describes the resources CloudFormation should manage. delegate provisioning work to code. Its provider, the code handling that resource, must complete a request-and-response exchange before CloudFormation can continue.
How it works
- Set
ServiceTokento a Lambda function or SNS topic in the stackA group of resources created and managed together from a CloudFormation template.’s Region. - CloudFormation sends
Create,Update, orDeletewith properties and aResponseURL. Property changes cause an update request. - The provider performs its work and sends a JSON
SUCCESSorFAILEDresponse to that presigned S3 URL. A presigned URLA URL that grants temporary authorization for a specific request to an S3 object. grants access for that specific request; VPCA logically isolated virtual network in which AWS resources can run. networking must allow the S3 response path. - Return attributes for
Fn::GetAtt. During update, keepPhysicalResourceIdunchanged for an update in place; a changed ID makes CloudFormation replace the resource and delete the old one.
Exam cues
- If the question says a Lambda finishes but its CloudFormation resource hangs, think the response URL, because a normal Lambda return does not deliver the required S3 response.
- If the question says a disposable S3 bucket must empty itself before stack deletion, think a custom resource with deletion logic, because CloudFormation cannot delete a non-empty bucket. CDK
autoDeleteObjectsuses that mechanism. - If the question says a provider returns a new physical IDThe identifier of an actual provisioned resource, which changes when CloudFormation replaces it. on update, think replacementAn update that provisions a new physical resource in place of the previous one., because CloudFormation sends deletion for the old ID.
Remember
ServiceTimeout: 1 to 3600 seconds, default 3600 seconds.- Every lifecycle request needs a response, including
Delete. - The CDK deletion example uses
autoDeleteObjects: truewithRemovalPolicy.DESTROY.
Trap: Successful execution of the provider does not complete the CloudFormation custom resource. The provider must send the lifecycle response to ResponseURL.
Send the lifecycle request to the provider.
Upload the required response to the presigned S3 URL.
Box details (3)
- Stack request
CloudFormation sends Create, Update, or Delete with a presigned ResponseURL.
- Lambda provider
The ServiceToken selects the provider that performs the custom work.
- S3 response URL
The provider sends JSON SUCCESS or FAILED to ResponseURL so CloudFormation can proceed.
From the AWS docs (11)
- CloudFormation custom resources run provider-defined provisioning logic for Create, Update, and Delete lifecycle requests.
- ServiceToken identifies a Lambda function or SNS topic in the same Region as the stack.
- CloudFormation sends Update to a custom resource provider when the custom resource properties change.
- The custom resource provider must send a JSON SUCCESS or FAILED response to the presigned S3 ResponseURL for each lifecycle request.
- A provider in a VPC needs access to the CloudFormation-specific S3 bucket to send its response; otherwise the stack operation fails.
- Custom resource ServiceTimeout ranges from 1 to 3600 seconds and defaults to 3600 seconds.
- An Update response with a different PhysicalResourceId means replacement and causes CloudFormation to send Delete for the old resource.
- Fn::GetAtt reads provider-defined custom resource return attributes.
- The CDK S3 autoDeleteObjects feature uses a custom resource to remove bucket objects during deletion and prevent new writes during cleanup.
- The CDK bucket deletion example combines autoDeleteObjects true with RemovalPolicy.DESTROY.
- CloudFormation cannot delete a bucket unless its objects have been removed.
Macros and transforms
A CloudFormation macroA Lambda-backed processor that rewrites template content before CloudFormation provisions resources. processes templateA JSON or YAML document that describes the resources CloudFormation should manage. text before CloudFormation provisions the resulting resources. It lets template authors use reusable snippets or custom syntax that expands into a CloudFormation template.
How it works
- Implement a Lambda function that accepts template content and returns processed content. Register it with
AWS::CloudFormation::Macro. - Reference the macro in
Transformfor the whole template orFn::Transformfor a snippet, a selected part of the template. - Create a change setA preview of proposed stack changes that must be executed before CloudFormation applies them. from the processed templateThe template after CloudFormation has resolved included modules into resources. and review it, because the macro can add resources.
- Execute the reviewed change set. If creating or updating directly without that review, acknowledge
CAPABILITY_AUTO_EXPAND.
| TransformA template instruction that invokes processing on all or part of a template. | Processing |
|---|---|
| Custom macro | Lambda-defined template changes |
AWS::Include |
Insert reusable template snippets |
AWS::Serverless |
Expand SAM syntax into CloudFormation resources |
Exam cues
- If the question says custom template syntax must expand before provisioning, think a macro, because its Lambda function transforms the template first.
- If the question says directly deploy a macro template without change set review, think
CAPABILITY_AUTO_EXPAND, because expansion must be acknowledged.
Remember
- Define the macro in each account that uses it. Definitions can share a Lambda function with cross-account access.
- Service-managed StackSets do not support macro-containing templates.
Trap: The submitted template is not the complete resource plan when macros are involved. Review the processed change set to see what expansion introduces.
Send template content to the registered macro Lambda function.
Create the change set using the processed content.
Box details (3)
- Input template
Transform or Fn::Transform selects template content for processing.
- Macro Lambda
Return the processed template or snippet.
- Change set
Review resources introduced by the processed content before execution.
From the AWS docs (10)
- A CloudFormation macro uses a Lambda function to process a template or snippet before resource provisioning.
- AWS::CloudFormation::Macro registers the Lambda function that provides custom template processing.
- The Transform section invokes a macro on an entire template; Fn::Transform invokes it on part of a template.
- CloudFormation generates a change set from macro-processed content, which can introduce additional resources.
- AWS recommends reviewing the processed change set before execution.
- Direct stack creation or updating with macros without prior change set review requires CAPABILITY_AUTO_EXPAND.
- AWS::Include is a CloudFormation-hosted transform that inserts reusable template snippets.
- AWS::Serverless is a CloudFormation-hosted transform that expands SAM syntax into CloudFormation resources.
- Service-managed StackSets do not support templates containing macros.
- A macro must be defined in the account using it; multiple account macro definitions can reference a shared Lambda function with cross-account access.
Reusable modules
A CloudFormation moduleA reusable package of resource configurations and inputs expanded into a stack template. packages a reusable resource configuration with inputs that customize it. It lets teams reuse an approved infrastructure pattern while CloudFormation still exposes the resources the pattern creates. A schemaA contract describing a module's accepted inputs and resource definitions. is the contract describing those inputs and resources.
How it works
- Define a template fragmentThe part of a module package that defines its resources and related configuration., the resource definitions and related configuration to reuse, and generate its schema. Package them for registration.
- Register the private module in each target account and Region. With
AWS::CloudFormation::ModuleVersion, the package is stored in S3 and registration needss3:GetObjectpermission. - Add the type under
Resourcesusingorganization::service::use-case::MODULE. Supply module inputs throughProperties; templateA JSON or YAML document that describes the resources CloudFormation should manage. parametersA typed input supplied to customize a stack when it is created or updated. can provide those values. - CloudFormation expands the module into the processed templateThe template after CloudFormation has resolved included modules into resources.. Review a change setA preview of proposed stack changes that must be executed before CloudFormation applies them., a preview of resource changes, before executing the operation. Using modules · Registration
| Version choice | Behavior |
|---|---|
| First registration | Becomes the default until explicitly changed |
AWS::CloudFormation::ModuleDefaultVersion |
Selects a version using Arn, or ModuleName and VersionId |
| Normal template processing | Resolves the current default in the operation’s account and Region |
| Use previous template | Reuses the previous processed template without expanding modules again |
A version is immutable, meaning it cannot be edited after registration. Register a new version to change the pattern. Align defaults across deployment accounts and Regions, including defaults for nested modules. Version selection · Operation behavior
Exam cues
- If the question says distribute an approved resource configuration as a template building block, think a registryThe account and Region repository for CloudFormation extension registrations and versions. module, because it packages the configuration and its inputs.
- If the question says a new module default did not change deployed stacksA group of resources created and managed together from a CloudFormation template., think a later stack operation, because changing the default does not start an update.
- If the question says an update still uses the old expansion, think use previous template, because that option reuses the processed template.
- If the question says reject an invalid module input, think a constrained template parameter, because module parameter constraints are not enforced.
Remember
- Private module registration is scoped to the account and Region.
- Modules can nest up to three levels deep.
- Module fragments cannot contain nested stacks, StackSets, macrosA Lambda-backed processor that rewrites template content before CloudFormation provisions resources., transformsA template instruction that invokes processing on all or part of a template.,
Fn::ImportValue, or exported outputs. - Expanded resources still count toward processed-template quotas. Fragment restrictions · Input constraints
Trap: A newer registered module version does not automatically become the default after the first registration. Select the new default explicitly; existing stacks still need an operation that processes the module.
Resolve registered modules into the processed template.
Review the expanded resources in a change set and execute it.
From the AWS docs (17)
- A module packages reusable resource configurations and customizable inputs for inclusion in stack templates.
- A module contains a template fragment defining its resources and a generated schema defining its input and resource contract.
- Register a private module in the account and Region where its template will be deployed.
- Module type names use organization::service::use-case::MODULE and are placed in the template Resources section.
- CloudFormation resolves modules into resources in the processed template, and change sets show their resource changes.
- AWS::CloudFormation::ModuleVersion registers a module package stored in S3; the registering identity needs s3:GetObject on the package.
- A registered module version cannot be edited; updating ModuleVersion registers a new version.
- The first registered module version remains the default until another version is explicitly selected.
- AWS::CloudFormation::ModuleDefaultVersion selects a default using Arn or ModuleName together with VersionId.
- Stack operations resolve the current default module version in the operation account and Region, including nested modules.
- Changing a default module version does not update existing stacks.
- A stack update using the previous template reuses the previous processed template without reprocessing modules.
- Pass module inputs through its Properties; template parameters can supply those values.
- Module parameter constraints are not enforced; validate inputs using constrained template parameters passed into the module.
- Module fragments cannot contain Fn::ImportValue, exported outputs, macros or transforms, nested stacks, or StackSets.
- Modules can contain other modules with nesting up to three levels deep.
- Resource-count and template-size quotas apply to the processed template including resources expanded from modules.
Hooks
A CloudFormation HookA check invoked before selected provisioning operations or during change set creation. checks a proposed configuration before an operation proceeds. It can enforce an organization’s rules at the resource, stackA group of resources created and managed together from a CloudFormation template., or change setA preview of proposed stack changes that must be executed before CloudFormation applies them. boundary, and can also evaluate Cloud Control API operations.
How it works
- Choose a Guard, Lambda, or proactive control-based Hook and configure its checks.
- Activate it and set
HookInvocationStatustoENABLED. Select the target operations and actions. - Select the failure mode. Start with
WARNto observe failures, then switch toFAILwhen blocking is intended.
| Target | What it evaluates | Actions |
|---|---|---|
RESOURCE |
CloudFormation resource operation | CREATE, UPDATE, DELETE |
STACK |
Stack templateA JSON or YAML document that describes the resources CloudFormation should manage. | CREATE, UPDATE, DELETE |
CHANGE_SET |
Change set | CREATE only |
CLOUD_CONTROL |
Cloud Control API resource operation | CREATE, UPDATE, DELETE |
Exam cues
- If the question says reject a noncompliant resource before CloudFormation provisions it, think a Hook with
FAIL, because failed evaluation stops provisioning. - If the question says assess a new policy without blocking stacks, think
WARN, because provisioning continues with a warning.
Remember
HookInvocationStatusisENABLEDorDISABLED.WARNpermits progress;FAILstops it and can trigger stack rollbackRecovery that attempts to return a stack to its previous working configuration after a failed operation..
Trap: Hooks are not limited to CloudFormation stack calls. CLOUD_CONTROL targets cover Cloud Control API operations too; coverage depends on the configured target and action.
From the AWS docs (9)
- A CloudFormation Hook evaluates configured targets before provisioning or during change set creation.
- Hook targets can be RESOURCE, STACK, CHANGE_SET, or CLOUD_CONTROL.
- RESOURCE, STACK, and CLOUD_CONTROL targets support CREATE, UPDATE, and DELETE actions; CHANGE_SET supports CREATE only.
- FailureMode FAIL stops provisioning on a failed check; for a stack operation, the configuration can roll back the stack.
- FailureMode WARN permits provisioning to continue with a warning when the check fails.
- AWS recommends activating Hooks in WARN to assess effects before switching to FAIL.
- HookInvocationStatus ENABLED enables an activated Hook; DISABLED prevents invocation.
- CloudFormation offers Guard Hooks, Lambda Hooks, and proactive control-based Hooks.
- Hooks can evaluate resource operations performed through the Cloud Control API as well as CloudFormation.
Stack policies
A CloudFormation stackA group of resources created and managed together from a CloudFormation template. policy protects selected resources from accidental changes during a stack update. It describes which update actions are allowed, rather than which users may access AWS resources.
How it works
- Set a JSON stack policy. Before a policy exists, a caller with stack-update permission can update all stack resources; afterward, resources need explicit
Allowcoverage. - Allow ordinary updates and deny the actions that must be protected. An explicit
Denywins overAllow. - For an intended exception, supply a temporary override policy with that update. This requires
cloudformation:SetStackPolicypermission and leaves the permanent policy unchanged.
| Action | Restricts |
|---|---|
Update:Modify |
Changes to an existing resource |
Update:Replace |
ReplacementAn update that provisions a new physical resource in place of the previous one. with a new resource |
Update:Delete |
Removal during a stack update |
Exam cues
- If the question says protect a database from accidental replacement during updates, think a stack policy denying
Update:Replace, because it restricts that resource update action. - If the question says allow one approved change without removing ongoing protection, think a temporary policy override, because it applies to that update only.
Remember
- A stack policy applies to all users updating the stack.
- It cannot be deleted; edit it to allow all update actions when removing protection.
- IAM controls resource access authorization.
Trap: Update:Delete means removal during an update. It does not block deletion of the entire stack.
From the AWS docs (9)
- A stack policy is a JSON document that restricts update actions on selected stack resources for all users.
- Without a stack policy, all resource update actions are allowed to a caller with stack-update permission.
- After a stack policy is set, resource updates require explicit Allow statements.
- An explicit Deny in a stack policy overrides Allow.
- Stack policy actions are Update:Modify, Update:Replace, and Update:Delete.
- A temporary stack policy supplied with an update overrides protection only for that update without changing the permanent policy.
- Updating protected resources requires permission for cloudformation:SetStackPolicy.
- A stack policy cannot be deleted; edit it to allow all update actions if protection must be removed.
- Stack policies apply to stack updates, not stack deletion or resource access authorization, which is controlled by IAM.
Flashcards
Nothing to review here right now. Pick other topics or another filter.
·
All 158 cards as a list
Which section must a CloudFormation template contain, and what does it define?
Resources. It defines each resource with a logical ID, type, and configuration properties.
How does CloudFormation order resources when resource A references resource B?
B is created and updated before A, and deleted after A. Use DependsOn for an explicit dependency when no reference establishes it.
A CloudFormation template needs a generated resource attribute rather than its identifying value. Which function should the team choose?
Fn::GetAtt. Ref returns the resource-specific identifying value; GetAtt reads a named attribute.
Two CloudFormation resources have no reference between them, but one must finish creation first. What should the team add?
DependsOn on the dependent resource. It establishes the missing order.
A team needs to provision and manage the same infrastructure from a reusable definition. What should it use?
Use an AWS CloudFormation JSON or YAML template to provision and manage a stack of resources.
A CloudFormation deployment has resources that must be created in a specific order. How can the template express that requirement?
Use resource references for implicit dependencies, or DependsOn to specify an explicit dependency.
A CloudFormation template sets BucketName: app-logs. Deploying it as a second stack in the same account fails. What change lets the template be reused?
Remove the custom name. CloudFormation then generates a unique physical ID; custom names must be unique across active stacks.
An AWS CloudFormation stack already manages an application environment. How should a team apply a revised template to that environment?
Update the existing stack with the revised template. CloudFormation uses differences from the stack's current template and parameters to determine resource changes.
How do CloudFormation parameters, pseudo parameters, and mappings differ?
Parameters are supplied inputs. Pseudo parameters such as AWS::Region come from CloudFormation. Mappings are literal lookup tables read with Fn::FindInMap.
How can a CloudFormation template create a resource only for a production environment?
Define a condition using the environment input and attach it with Condition. Use Fn::If for conditional property values and AWS::NoValue to remove a property.
A CloudFormation template must serve test and production without manual edits. Which features select values and resources?
Parameters supply inputs, mappings supply lookup values, and conditions control resource creation.
CloudFormation stacks must resolve a current AMI without hardcoded IDs. What parameter type should they use?
AWS::SSM::Parameter::Value<AWS::EC2::Image::Id> with an AWS public Parameter Store key. UsePreviousValue preserves the key, so a later operation can resolve a newer AMI.
A CloudFormation template must reject an environment outside an approved list and explain the error. What should the team set?
AllowedValues and ConstraintDescription on the parameter. Use AllowedPattern for a string pattern, length bounds for strings, and value bounds for numbers.
A CloudFormation template must select an Availability Zone without hardcoding its name. Which functions should it combine?
Fn::GetAZs and Fn::Select. Verify that the selected zero-based index exists; default-subnet filtering can shorten the list and its order can change.
Which CloudFormation function generates subnet address ranges from a larger address block?
Fn::Cidr. It returns a list of smaller CIDR blocks and accepts a count from 1 to 256.
A Parameter Store AMI value changes after a CloudFormation change set is created. Which value does execution use?
The value resolved when the change set was created. Create a new change set to resolve a later value.
A CloudFormation template needs a new Parameter Store parameter, while another template reads an existing AMI parameter. Which features serve each need?
Use an AWS::SSM::Parameter resource to create the parameter. Use AWS::SSM::Parameter::Value<AWS::EC2::Image::Id> to read an existing AMI value.
A CloudFormation template needs a plaintext String value from an existing Systems Manager Parameter Store parameter. Which dynamic reference can retrieve it?
Use an ssm dynamic reference to the existing parameter.
Does NoEcho prevent a CloudFormation parameter from appearing in Outputs or Metadata?
No. NoEcho masks parameter describe results, but does not redact Outputs, template Metadata, or resource Metadata. Use external secret storage and dynamic references for supported properties.
A CloudFormation template needs a password without embedding it. What should it use, and will a secret-only change refresh the resource?
Use a secure dynamic reference to Secrets Manager or a supported Parameter Store SecureString. A secret-only change does not cause CloudFormation to update the consuming resource.
A CloudFormation template must retrieve an encrypted Parameter Store password. Which reference pattern should it use?
ssm-secure for a supported resource property. CloudFormation stores the literal reference rather than the resolved secure string.
A CloudFormation RDS DBCluster must let RDS manage its master password in Secrets Manager. What should the team configure?
Set ManageMasterUserPassword and omit MasterUserPassword. These properties cannot be used together.
A database secret used by CloudFormation lacks the connection information needed for rotation. Which resource supplies it?
AWS::SecretsManager::SecretTargetAttachment. It adds the database connection details; supplying those details alone does not enable rotation.
A CloudFormation user changes a Secrets Manager value but leaves its resource unchanged. Why does the resource still use the old value?
CloudFormation rereads the secret during creation or an update that modifies the consuming resource. A secret-only change does not trigger that operation.
A team changes a CloudFormation stack cost-center tag. Does it need a manual retagging script, and will every resource receive the tag?
A stack tag change starts a stack update and retags resources supporting stack-tag propagation. Propagation varies by type; EBS volumes created from block device mappings are an exception.
A CloudFormation Auto Scaling group has PropagateAtLaunch disabled. Do its instances still receive stack-level tags?
Yes. Stack-level tags reach the instances regardless of PropagateAtLaunch; that setting controls propagation of group resource tags.
How many user tag pairs can a CloudFormation stack accept?
Up to 50. AWS-reserved tags use the aws: prefix and do not count toward resource tag limits.
A team needs a cost-center label shared by supported CloudFormation resources. Where should it configure the label?
Set a stack-level tag. A later change to that tag initiates a stack update for resources that support propagation.
How can a team review the resource impact of a CloudFormation update before applying it?
Create a change set, review replacements and removals, then execute the chosen change set. The preview does not guarantee execution success.
Which CloudFormation update behaviors can a resource property require, and what happens on replacement?
No interruption, some interruption, or replacement. Replacement creates a new physical ID and usually creates the new resource before removing the old one.
How does a CloudFormation change set identify replacement risk for a modified resource?
Inspect Replacement (True, False, Conditional), property RequiresRecreation (Never, Conditionally, Always), and Scope. Check the resource property reference for interruption behavior.
A CloudFormation change set passes creation checks. Can execution still fail, and what happens to the other previews?
Execution can still fail on runtime conditions. Executing the change set removes other change sets associated with that stack.
A CloudFormation update must replace a resource with a custom name. How should the team avoid the name conflict?
Supply a new name for the replacement. CloudFormation cannot replace the resource while reusing its custom name.
CloudFormation reports No updates to perform after only policy, condition, or output changes. How can the team apply those changes?
Add or modify a Metadata attribute on a resource in the same update. CloudFormation may not recognize those changes alone as an update.
A CloudFormation root stack contains several nested stacks. How can a reviewer preview the entire update hierarchy?
Create the change set with IncludeNestedStacks true and inspect the nested changes. Execute or delete the hierarchy through its root change set.
A new CloudFormation stack has REVIEW_IN_PROGRESS after a CREATE change set. Has provisioning started?
No. Only the stack record exists; resources are created when the change set is executed.
An RDS DB instance managed by CloudFormation needs a major engine upgrade. Which properties express the request?
Set EngineVersion to the target version and AllowMajorVersionUpgrade to true. The Boolean permits the major upgrade; it does not choose the version.
A pipeline uploads new Lambda code to the same S3 key and updates the stack, but the function keeps the old code. Why, and what fixes it?
CloudFormation sees no change in S3Bucket, S3Key or S3ObjectVersion. Use a new key or pass the new S3ObjectVersion.
A CloudFormation change set would replace an RDS database. Which policy protects the old physical database?
UpdateReplacePolicy: Retain or Snapshot on a supported type. Replacement normally creates the new resource before disposing of the old one.
When does CloudFormation DeletionPolicy apply, and what is its default?
It applies to stack deletion and removal from a template. Delete is the default, except Snapshot for RDS DBCluster and RDS DBInstance without DBClusterIdentifier. Options are Delete, Retain, RetainExceptOnCreate, and Snapshot for supported types.
Does DeletionPolicy: Retain protect the old resource during a CloudFormation replacement update?
No. Use UpdateReplacePolicy: Retain or Snapshot. Snapshot on an unsupported UpdateReplacePolicy resource falls back to Delete.
A CloudFormation resource should survive normal stack deletion but be removed if its initial creation rolls back. Which policy fits?
DeletionPolicy: RetainExceptOnCreate. It deletes the resource when its creating operation rolls back and retains it for later removals.
A CloudFormation resource is removed from its template with DeletionPolicy: Retain. Is CloudFormation still managing it?
No. The physical resource remains and can still incur charges, but leaves CloudFormation management.
How can a team give a CloudFormation stack a new name without deleting its resources?
Set DeletionPolicy Retain on every resource, delete the stack, then import the retained resources into a new stack with the new name.
A CloudFormation stack reaches ROLLBACK_COMPLETE after its first creation failed. How can the team deploy again?
Delete the stack and create it again. For a diagnostic attempt, preserve successfully provisioned resources so failures remain available for investigation and retry or update.
A CloudFormation EC2 bootstrap fails. Which records should the team inspect?
Read the stack events and status reason, then /var/log/cfn-init.log for helper output, /var/log/cfn-init-cmd.log for commands, and /var/log/cloud-init-output.log for user-data output.
A CloudFormation stack is DELETE_FAILED because a resource cannot be removed. What recovery options exist?
Fix the dependency, contents, or delete permission and retry; retain the failed resource with RetainResources; or force-delete the stack, leaving undeletable resources and their dependencies behind.
Does CloudFormation termination protection block an update that removes a nested stack?
No. It blocks stack deletion requests. Protection is disabled by default and is controlled through the root stack for nested stacks. A blocked deletion leaves the status unchanged.
A populated S3 bucket causes CloudFormation stack deletion to fail. How can the team complete deletion?
Empty the bucket and retry, or retain that failed resource while deleting the stack. CloudFormation cannot delete a non-empty bucket.
A team needs to inspect an EC2 instance after CloudFormation creation fails and then resume provisioning. Which failure option should it select?
Preserve successfully provisioned resources. It leaves successful creations available and lets the team troubleshoot, then retry or update.
A protected CloudFormation stack receives a DeleteStack request. Does it become DELETE_FAILED?
No. Termination protection rejects deletion and leaves the stack and its status unchanged.
A CloudFormation update with nested stacks failed. How does an engineer list only the failed events of that update?
Use describe-events with the update's operation ID and the FailedEvents=true filter.
A CloudFormation template with custom-named IAM resources fails with InsufficientCapabilities. Which acknowledgment is missing?
CAPABILITY_NAMED_IAM. CAPABILITY_IAM can acknowledge unnamed IAM resources; custom names require CAPABILITY_NAMED_IAM.
What changes when a CloudFormation stack has a service role, and why must its permissions be narrow?
CloudFormation uses the role for all stack operations. It cannot be removed, though it can be changed. Users allowed to operate the stack can use the role without iam:PassRole, which can expose the role permissions to them.
A team directly creates a CloudFormation stack containing macros without first reviewing a change set. Which capability acknowledges expansion?
CAPABILITY_AUTO_EXPAND. Review a processed change set when possible because macros can introduce additional resources.
A user can update a CloudFormation stack but lacks iam:PassRole for its already attached service role. Can the stack operation still use that role?
Yes. Existing stack operators can use the attached role through stack operations. Limit both stack access and the role permissions.
What permission is required to attach a service role to a CloudFormation stack?
iam:PassRole for the role. The role must trust cloudformation.amazonaws.com.
How should a team update a reusable nested CloudFormation stack?
Change the nested template or its inputs and initiate the update from the root stack. CloudFormation updates affected nested stacks; direct child updates are not recommended.
A CloudFormation parent stack must send an environment value to a child template. Which property should it set?
Parameters on the AWS::CloudFormation::Stack resource. The property supplies the child template inputs.
Two nested CloudFormation stacks need to share an identifier under one parent. How should the parent connect them?
Read the producer with Fn::GetAtt Child.Outputs.OutputName and pass that value in the consumer child Parameters.
What is the difference between a root stack and a parent stack in CloudFormation?
The root is the top of the whole hierarchy. A parent is the immediate stack that contains a particular child.
A template needs 700 resources. What does CloudFormation require?
Splitting it, for example into nested stacks, because one template can declare at most 500 resources.
Two independent CloudFormation stacks in one account and Region need a shared identifier with deletion protection. What should they use?
Export an output and read it with Fn::ImportValue. Export names are unique within the account and Region, and imports block changing that value or deleting its source stack.
Several independently managed CloudFormation application stacks need subnet IDs from a network stack. How should they share them?
Export the network outputs and use Fn::ImportValue in each application stack in the same account and Region. Nested stacks fit a shared root hierarchy instead.
A CloudFormation network stack cannot be deleted because another stack imports an output. What must the team do first?
Remove every import of the export. Use list-imports to identify consumers, update them, and then delete the producer.
Can a CloudFormation export name depend on an identifier returned by a resource Ref?
No. Export names and ImportValue expressions cannot depend on resource-dependent Ref or GetAtt values.
A CloudFormation stack must wait for EC2 software setup before creation completes. What should the team configure?
Attach CreationPolicy with ResourceSignal and send cfn-signal after setup. Count defaults to 1; Timeout defaults to PT5M and permits up to 12 hours. A failure or timeout fails resource creation.
Which CloudFormation resource types support CreationPolicy, and how can an Auto Scaling group set its success percentage?
EC2 Instance, Auto Scaling AutoScalingGroup, CloudFormation WaitCondition, and AppStream Fleet. For a group, set AutoScalingCreationPolicy.MinSuccessfulInstancesPercent; its default is 100.
After CloudFormation metadata changes on a running EC2 instance, what can rerun its configuration?
cfn-hup detects the metadata change and runs a configured action such as cfn-init. Metadata changes alone do not invoke cfn-init.
How do CloudFormation wait-condition handle signals differ from CreationPolicy signals?
A WaitConditionHandle receives signals through a presigned S3 URL and needs S3 reachability. CreationPolicy uses cfn-signal or SignalResource; a WaitCondition can also be configured with CreationPolicy to use SignalResource. Prefer CreationPolicy for EC2 and Auto Scaling readiness.
An EC2 instance exists but its software is not ready. How can CloudFormation prevent stack creation from completing early?
Use CreationPolicy and send cfn-signal only after software setup succeeds. The policy waits for success signals rather than just instance provisioning.
A CloudFormation bootstrap must install packages, write files, and then run a separate application configuration. How can it control multiple configurations?
Define configSets in the required config-key order and select that configset when calling cfn-init. Each config key has a fixed internal processing order.
An EC2 image lacks CloudFormation helper scripts and bootstrap cannot run cfn-init. What should the template bootstrap do?
Install aws-cfn-bootstrap before calling the helper. Helper scripts are not automatically run and are not included in every image.
Which CloudFormation intrinsic function encodes EC2 UserData?
Fn::Base64 returns the encoded form of the user-data string.
A private EC2 instance sends a wait-condition handle signal but CloudFormation never receives it. What connectivity must the team check?
Access to the CloudFormation-specific S3 bucket used by the presigned URL. A CloudFormation interface endpoint alone does not provide that response path.
A CloudFormation update rollback fails and the stack is UPDATE_ROLLBACK_FAILED. How should the team recover?
Read the failure reason, fix its cause, and continue update rollback. The stack must reach UPDATE_ROLLBACK_COMPLETE before another update can proceed.
When should a team skip resources during CloudFormation update rollback, and what must happen afterward?
Skip the minimum rollback-failing resources only when their cause cannot be fixed. Skipped resources become UPDATE_COMPLETE but must be reconciled with the template before another update. force-rollback skips rollback failures across nested stacks and cannot be combined with resources-to-skip.
A CloudFormation rollback fails inside a nested stack and the team must skip one resource. Which identifier format is required?
NestedStackName.ResourceLogicalID. Select a resource that failed during rollback, not one that only failed during the forward update.
Automation must run only after a successful CloudFormation stack update. Which EventBridge event fields should it match?
Match source aws.cloudformation, detail-type CloudFormation Stack Status Change, and detail.status-details.status equal to UPDATE_COMPLETE.
A CloudFormation rollback skip marks a resource UPDATE_COMPLETE. Does that prove it matches the template?
No. The status allows rollback to continue. Reconcile the skipped resource and template before the next update.
How can a CloudFormation update roll back when an application metric degrades during deployment or shortly afterward?
Configure up to 5 CloudWatch alarm rollback triggers and a monitoring period of 0 to 180 minutes. ALARM triggers rollback; INSUFFICIENT_DATA alone does not.
A CloudFormation update uses MonitoringTimeInMinutes 0. Are its rollback-trigger alarms ignored during deployment?
No. CloudFormation still monitors alarms during the operation. Zero removes the additional monitoring period after resource deployment.
A CloudFormation rollback should occur when application metrics stop arriving. What must the alarm do?
Treat missing data as breaching so the alarm can enter ALARM. INSUFFICIENT_DATA by itself does not start rollback.
Which CloudWatch alarm types can CloudFormation use as rollback triggers?
Metric alarms (AWS::CloudWatch::Alarm) and composite alarms (AWS::CloudWatch::CompositeAlarm).
What does CloudFormation drift detection compare, and what statuses describe its results?
Supported, explicitly configured properties against actual resources. Resource statuses: IN_SYNC, MODIFIED, DELETED, NOT_CHECKED. Stack statuses: IN_SYNC, DRIFTED, NOT_CHECKED.
Why can a CloudFormation drift check miss an external configuration change?
The type may be unsupported, the property may not be explicitly configured or readable, or the change may be inside a nested stack that needs a separate check. Detection itself does not repair configuration.
How can a team reconcile a drifted CloudFormation resource while preserving an accepted live configuration?
Update the template to match the live state. For supported properties, a drift-aware change set can reconcile it. If adoption would require replacement, use Retain, remove, and import for a resource supporting import.
How can a team evaluate and route CloudFormation drift findings?
Use the Config rule cloudformation-stack-drift-detection-check for recurring evaluation, or match CloudFormation Drift Detection Status Change events from aws.cloudformation with detail.stack-drift-status equal to DRIFTED.
Does a successful parent-stack drift check prove that all nested CloudFormation resources match their templates?
No. Run drift detection separately on nested stacks. Unsupported types, unspecified defaults, and unreadable properties also limit coverage.
A CloudFormation baseline spans accounts through StackSets. How can a team check configuration drift across its instances?
Run StackSet drift detection. It checks each member stack against its own template and parameter overrides, then aggregates the results.
A CloudFormation update must preview and restore live properties changed outside the template. Which change set mode should the team use?
REVERT_DRIFT for a drift-aware change set. It compares actual, previous, and desired states for supported properties before execution.
A team changes a StackSet member template through a direct CloudFormation stack update. Is that template difference necessarily reported as drift?
No. Drift compares each stack resource with that stack own expected configuration. A direct stack update is not itself an unmanaged resource change.
A CloudFormation stack drift detection operation fails to inspect an EC2 instance because of permissions. What access must the caller have?
Grant the CloudFormation drift detection and type configuration permissions and resource read access such as ec2:DescribeInstances.
Does an IN_SYNC CloudFormation drift result prove that Lambda source code and KMSKeyId properties match the template?
No. CloudFormation does not compare Lambda source code or KMSKeyId properties during drift detection.
A CloudFormation stack contains no resources that support drift detection. Can its stack drift status still be IN_SYNC?
Yes. IN_SYNC does not prove that unsupported resources were checked.
A CloudFormation security group has ingress resources in another stack. Why might drift detection report an inaccurate difference?
CloudFormation cannot analyze resource attachments across stacks during the comparison.
An automation calls CloudFormation DetectStackDrift. How does it wait for results and retrieve resource differences?
Use the returned operation ID with DescribeStackDriftDetectionStatus, then call DescribeStackResourceDrifts.
A CloudFormation drift-aware change set fails during deployment after an emergency manual change. Which state does rollback restore?
The actual pre-deployment state, preserving out-of-band changes made since the last deployment.
How can a security team audit CloudFormation stacks for configuration drift on a recurring basis?
Use the AWS Config cloudformation-stack-drift-detection-check rule. It runs periodically and on configuration changes, reporting drifted stacks as NON_COMPLIANT.
An IAM policy in one CloudFormation stack attaches to a role in another. What risk does a drift-aware change set pose for that attachment?
It can detect the cross-stack attachment as drift and revert it.
An AWS Config CloudFormation drift detection rule times out while evaluating many stacks. How can the team reduce the work per evaluation?
Split stacks into tagged groups and create separately scoped rule instances. The rule has a 15-minute execution limit.
An AWS Config remediation action must update a CloudFormation stack with an approved template stored in S3. Which Systems Manager Automation runbook does that?
AWS-UpdateCloudFormationStack. It updates the stack named by StackNameOrId with the template at TemplateUrl. To reconcile drifted properties themselves, use a drift-aware change set.
The Config rule cloudformation-stack-drift-detection-check times out in an account with hundreds of stacks. What fixes it?
Scope the rule to fewer stacks with tags; it runs DetectStackDrift on every stack within a 15-minute limit.
A stack's drift result shows NOT_CHECKED for some resources. Why?
Their resource types don't support drift detection.
A CloudFormation stack must read an output from another account or Region. Which function supports this, and what protection does it provide?
Fn::GetStackOutput. It needs no Export, but its weak reference does not block source deletion or automatically refresh the consumer after source changes.
A CloudFormation GetStackOutput read must cross both account and Region boundaries. Which settings and permissions are needed?
Set Region and RoleArn for the source. That source role needs cloudformation:DescribeStacks and must be assumable by the consuming stack execution role.
A source stack output changes after a consumer used CloudFormation GetStackOutput. Will the consumer automatically receive the new value?
No. The value resolves on consumer create or update. The weak reference neither updates the consumer nor blocks source changes.
When should CloudFormation use ImportValue rather than GetStackOutput for a local stack output?
Use ImportValue when a same-account, same-Region export should block deletion of its source. GetStackOutput supports broader scope but has a weak reference.
A team needs one CloudFormation template deployed as separate stacks across accounts and Regions. Which feature should it use?
StackSets. Each stack instance associates the StackSet with a target account and Region.
How do CloudFormation self-managed and service-managed StackSet permissions differ?
Self-managed: configure administrator and execution roles with cross-account trust. Service-managed: use Organizations trusted access and let StackSets create the needed roles.
A CloudFormation baseline must reach every new account in an OU automatically. What should the team configure?
A service-managed StackSet targeting the OU with automatic deployment. Choose whether to retain or delete stacks when an account leaves the target.
Will a CloudFormation service-managed StackSet deploy into the organization management account?
No. Management-account deployment is excluded even when targeting the organization. Handle its resources with a separate deployment.
Can a CloudFormation service-managed StackSet template contain nested stacks or macros?
No. Service-managed StackSets do not support nested stacks, macros, or transforms.
A CloudFormation baseline must reach OU members and the management account. Can one service-managed StackSet cover both?
No. Use the service-managed StackSet for members and a separate deployment for the management account, which is excluded.
Can a CloudFormation service-managed StackSet directly deploy a template containing the SAM transform?
No. AWS::Serverless is a transform, and service-managed StackSets do not support templates containing transforms.
How can a delegated administrator roll out a CloudFormation baseline to current and future OU accounts?
Use a service-managed StackSet with trusted access, OU targeting, and automatic deployment. A delegated administrator can initiate it; operations are performed by the management account.
A CloudFormation StackSet needs a larger instance size in one account and Region. Must the team duplicate the template?
No. Override that template parameter for the selected stack instances. Later StackSet updates preserve the overridden value.
A CloudFormation StackSet parameter override was applied to existing OU members. Will a newly added account inherit that override?
No. It receives the StackSet default values; overrides on existing members do not automatically apply to future members.
Which CloudFormation StackSet settings control deployment pace and tolerated failures?
Region concurrency and order, maximum concurrent accounts, and failure tolerance per Region. Sequential Region deployment is the default; exceeding tolerance stops the operation.
What do CloudFormation StackSet OUTDATED and INOPERABLE stack instances mean?
OUTDATED means the instance is not current after a failed or stopped create/update operation. INOPERABLE can follow failed deletion and is excluded from later updates; detach it with RetainStacks if required and clean up manually.
Some CloudFormation StackSet instances remain OUTDATED after an update. How should the team investigate and retry?
Read per-account StatusReason with list-stack-set-operation-results, or filter list-stack-instances by DETAILED_STATUS and LAST_OPERATION_ID. Fix the cause and retry with the current template. An overall SUCCEEDED can still contain tolerated failures.
A CloudFormation StackSet operation reports SUCCEEDED but some accounts lack the update. What should the team inspect?
FailedStackInstancesCount and per-instance status reasons. Failure tolerance can permit instance failures without failing the overall operation.
A team must stop managing selected CloudFormation stacks through StackSets while keeping their resources. What option should it use?
Delete the stack instances with Retain stacks enabled. The stacks stay in the target accounts and can be managed individually.
How do strict and soft CloudFormation StackSet failure tolerance differ?
Strict mode reduces actual account concurrency as failures occur, staying within failure tolerance plus one. Soft mode keeps the specified concurrency despite failures.
A CloudFormation StackSet fails to create IAM roles in one target account that has reached its role quota. What should the team investigate?
The target account's IAM role quota. A resource quota already reached in the target account can prevent stack creation.
A CloudFormation StackSet template creates an S3 bucket with a name already in use. Why can a target stack fail?
The bucket name must be globally unique. A collision for a global resource can cause the stack operation to fail.
A CloudFormation Auto Scaling rolling update must wait for EC2 application setup. Which settings make it wait?
Set AutoScalingRollingUpdate with WaitOnResourceSignals true and report readiness from each required instance. PauseTime becomes the timeout: default PT5M, maximum PT1H. Tune MaxBatchSize, MinInstancesInService, and the success percentage.
A CloudFormation update changes MaxBatchSize and then fails. Which policy values govern rollback?
The UpdatePolicy from before the failed update. Apply policy changes in a separate stack update before a replacement-triggering change.
How do CloudFormation AutoScalingRollingUpdate and AutoScalingReplacingUpdate differ?
Rolling replaces instances in the same group. Replacing with WillReplace true creates a new group and keeps the old group until success; pair it with CreationPolicy. WillReplace true takes precedence when both policies exist.
A CloudFormation Auto Scaling rolling replacement is disrupted by health replacement and scheduled scaling. Which policy setting helps?
SuspendProcesses. AWS recommends suspending interfering processes; its example lists HealthCheck, ReplaceUnhealthy, AZRebalance, AlarmNotification, ScheduledActions, and InstanceRefresh.
A CloudFormation Auto Scaling update must honor its instance maintenance policy. Should it use AutoScalingRollingUpdate?
Use AutoScalingInstanceRefresh. CloudFormation rolling updates do not honor that maintenance policy, and the two policies cannot be combined on one group.
What are the default CloudFormation rolling-update batch size, minimum in-service count, and signal-wait setting?
MaxBatchSize 1, MinInstancesInService 0, and WaitOnResourceSignals false. Enable signals explicitly when application readiness must control progress.
What must a CloudFormation custom resource provider do when it receives a lifecycle request?
Handle Create, Update, or Delete and send JSON SUCCESS or FAILED to the presigned S3 ResponseURL. ServiceToken identifies the same-Region Lambda function or SNS topic; GetAtt reads returned attributes.
A CloudFormation custom resource Lambda returns normally but the stack waits until timeout. Why?
The provider has not delivered a response to ResponseURL, possibly because its network cannot reach the S3 response bucket. Every lifecycle request needs a response. ServiceTimeout defaults to 3600 seconds.
What does a changed PhysicalResourceId in a CloudFormation custom resource Update response mean?
Replacement. CloudFormation sends a Delete request for the old physical resource, so the provider must handle the old resource separately.
A CloudFormation stack owns a disposable S3 bucket and must remove its objects automatically before deletion. What can supply the cleanup logic?
A deletion-handling custom resource. The CDK autoDeleteObjects feature uses that mechanism; its bucket deletion example pairs autoDeleteObjects true with RemovalPolicy.DESTROY.
A CloudFormation custom resource handles Create and Update but never responds to Delete. What goes wrong?
Deletion cannot complete successfully without the required response and eventually times out. Handle Delete and send its SUCCESS or FAILED response as well.
How can a CloudFormation custom resource shorten the wait for an unresponsive provider?
Set ServiceTimeout between 1 and 3600 seconds. Its default is 3600 seconds.
What is a CloudFormation macro, and when is its output used?
A Lambda-backed template processor registered with AWS::CloudFormation::Macro. Transform processes the full template and Fn::Transform processes a snippet before the processed resources are provisioned. AWS::Include and AWS::Serverless are hosted transforms.
A CloudFormation template uses custom shorthand that expands into several resources. How should a team review the resulting deployment?
Create and inspect a processed change set before executing it. Macro expansion can add resources that were not explicit in the submitted template.
A team directly creates a CloudFormation stack containing a macro without reviewing a change set. Which acknowledgment is required?
CAPABILITY_AUTO_EXPAND. It acknowledges direct macro processing before the stack operation.
Can a CloudFormation macro definition in one account automatically be called by templates in every other account?
No. Define the macro in each account that uses it. Those definitions can reference a shared Lambda function if cross-account access is granted.
What does a CloudFormation module contribute to a stack template?
Reusable resource configurations and inputs that CloudFormation expands into resources in the processed template.
A team must reuse an approved CloudFormation resource configuration across accounts and Regions. What must it prepare for module use?
Register the private module in each target account and Region, then use its module type under Resources with the required Properties.
A team changes the default CloudFormation module version and expects deployed stacks to change immediately. What happens?
Existing stacks stay unchanged. A later operation that processes the template resolves the current default; using the previous template reuses the old processed template.
Identical CloudFormation templates containing a module create different resources in two Regions. Which module setting should the team compare?
The default module version in each account and Region. Align defaults, including nested-module defaults, for consistent expansion.
How does a team release and select a new private CloudFormation module version?
Register a new version rather than editing an existing one. Set the desired default with AWS::CloudFormation::ModuleDefaultVersion using Arn or ModuleName and VersionId.
A CloudFormation module declares input constraints, but invalid values are not rejected. Where should input constraints be enforced?
On a template parameter passed into the module Properties. Module parameter constraints are not enforced.
Can a CloudFormation module contain a nested module, a nested stack, or a macro?
Nested modules are supported up to three levels deep. Nested stacks and macros are not allowed in module fragments.
Does packaging many CloudFormation resources into a module bypass stack resource-count limits?
No. Limits apply to the processed template, including the resources expanded from modules.
A team must reject noncompliant CloudFormation resource configurations before provisioning. What should it use?
An enabled CloudFormation Hook targeting the relevant operations with FailureMode FAIL. WARN reports failure but allows provisioning to continue. Guard, Lambda, and proactive control-based Hooks are available.
A team wants to observe a new CloudFormation Hook policy before blocking deployments. Which failure mode should it start with?
WARN. It lets provisioning continue while showing failures; switch to FAIL after assessing the impact.
Can a CloudFormation Hook evaluate a resource operation sent through the Cloud Control API?
Yes, with the CLOUD_CONTROL target. Hooks also support RESOURCE, STACK, and CHANGE_SET targets.
Which action invokes a CloudFormation Hook configured for a CHANGE_SET target?
CREATE. Unlike RESOURCE, STACK, and CLOUD_CONTROL targets, CHANGE_SET does not support UPDATE or DELETE target actions.
A CloudFormation database must resist accidental updates but allow one approved exception. What should the team use?
A stack policy restricting its update actions, plus a temporary override policy for the approved update. Explicit Deny wins; the policy guards updates and does not replace IAM or prevent stack deletion.
A CloudFormation stack policy was added with only one Allow statement. Why are other resource updates denied?
After a stack policy is set, updates need explicit Allow coverage. Resources without it are protected by default.
A CloudFormation stack policy denies replacement of a database. Can a temporary policy allow a single intended replacement?
Yes. Supply a temporary override for that update with the required SetStackPolicy permission. It does not permanently change the stack policy.
Does a CloudFormation stack policy prevent a user from deleting the entire stack?
No. It restricts actions during stack updates. IAM controls authorization; stack deletion needs separate protection.