Easy ReviewSAA-C03
Design Resilient Architectures17

CloudFormation

Define reusable infrastructure templates, deploy stacks across accounts and Regions, and control updates and recovery.

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

  1. 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.
  2. Supply optional inputs and logic using the sections below.
  3. Use Ref for a parameterA typed input supplied to customize a stack when it is created or updated. value or a resource’s identifying value, and Fn::GetAtt for a documented attribute. Use Fn::Sub to substitute string variables or Fn::Join to join strings with a separator.
  4. CloudFormation follows dependencies and runs independent operations in parallel. A referenced resource is created and updated first, then deleted last. Add DependsOn when the required order has no reference.
  5. 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, because Ref returns 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

  • Resources is 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 dependencies before their consumers
12Network resourceiDependent resourceiStack resourcesi
  1. Create the referenced resource before its dependent.

  2. 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.

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

  1. 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::Base64 encodes the user-data string.
  2. Call cfn-init to apply AWS::CloudFormation::Init metadataAdditional 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 through configSets.
  3. After configuration succeeds or fails, report the result with cfn-signal or SignalResource. A CreationPolicy waits for the required successes and fails creation on a failure signal or timeout.
  4. For later metadata changes, configure cfn-hup to run an action such as calling cfn-init again.
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 CreationPolicy plus cfn-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 invoke cfn-init automatically.
  • If the question says coordinate installation phases, think configSets, because it orders configuration keys.

Remember

  • ResourceSignal.Count defaults to 1; Timeout defaults to PT5M, 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-init looks for a key named config.

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.

Configure software before reporting readiness
12Init metadataiEC2 instanceiCreationPolicyi
  1. Run cfn-init on the instance to apply its metadata.

  2. 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.

Flashcards

tap to flip
Answer

·

All 17 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.

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.

You finished every topic of SAA-C03!

Your badge turned gold. Next step: book the exam on AWS. Once you pass, add yourself to Who passed.

Share

Share that you finished this certification

I finished every topic of AWS Certified Solutions Architect - Associate (SAA-C03) on Easy Review. Come study too!