What Is an AWS CloudFormation Template? Read Resources, Parameters, and Outputs
Learn how CloudFormation template sections connect to stack resources, how to handle sensitive values, and why change sets need careful review.
What Is an AWS CloudFormation Template? Read Resources, Parameters, and Outputs
An AWS CloudFormation template is a YAML or JSON document that declares the resources and settings for a stack. The required Resources section names each resource by a logical ID, type, and properties. Optional Parameters supply values for each deployment, and Outputs make useful results such as resource IDs or URLs easier to find. A template describes a target configuration rather than a line-by-line deployment script. Because updates can interrupt or replace resources, review a change set before executing it.
What do the three core sections do?
Start with Resources. Each entry has a unique logical ID within the template, a Type identifying the AWS resource, and Properties containing its configuration. For example, a logical ID such as WebBucket might refer to an AWS::S3::Bucket. The logical ID is a name for references inside the template; it is not necessarily the bucket's physical name. Check the resource-specific documentation for property names and update behavior.
Parameters are optional inputs that let the same template support different stacks without copying the file. A development and a production stack might use different instance sizes. The template can accept an instance type parameter and refer to it from Resources with Ref. Constraints such as AllowedValues or a numeric range can reject some invalid inputs, but they do not prove that a selected value meets the application's operational needs.
Outputs return useful values after stack operations, such as a bucket name or load balancer DNS name. Some outputs can be exported for references from other stacks. Outputs are not a place to hide secrets: AWS states that output values are not masked. Do not output passwords, tokens, or secret keys.
Do parameters safely hide secrets?
No. CloudFormation's NoEcho attribute masks parameter values in some console, CLI, and API displays, but it does not redact information placed in Metadata or Outputs. A sensitive value used in a resource's primary identifier may also appear in plaintext in the identifier or derived locations. Treat NoEcho as display masking, not as a secret store.
AWS recommends dynamic references to sensitive values stored and managed outside CloudFormation, for example in Systems Manager Parameter Store or Secrets Manager. Also consider where inputs, stack events, outputs, change sets, and deployment logs may expose values. The protection depends on the reference method and access permissions.
What does a change set show, and what does it not guarantee?
When you update a stack, CloudFormation compares the existing template with the changed template or parameter values and creates a change set. Review which resource properties will change and whether a resource may be retained, interrupted, or replaced. Replacement can create a new resource and then remove the old one. For stateful databases or storage, assess backups, data movement, and possible service interruption.
A change set does not guarantee deployment success. AWS notes that it may not catch issues such as exceeding quotas, insufficient permissions, or resource types that do not support the requested update. Template validation can find syntax and some configuration errors before provisioning, but it does not replace checking runtime permissions and conditions. After review and execution, inspect the stack status and result.
Example: reuse one web stack for development and production
Hypothetical example: A team defines a website bucket and load balancer in Resources, then supplies an environment name and an allowed size choice through Parameters. Development and production can reuse the same structure with different inputs. Outputs can expose a bucket name or endpoint that operators need, but not credentials.
If the team changes the production instance type, the change set helps show whether the property changes in place or may require replacement. Exact behavior depends on the resource type and property update rules. If the plan shows replacement or deletion, consider traffic impact, data retention, and recovery before proceeding. This example is illustrative; no AWS deployment or validation was performed.
A first-pass template review
**Resources:** identify logical IDs and types, and what data, network, or permissions the stack creates.
**Parameters:** check required values, defaults, allowed values, and whether sensitive values are embedded in the template.
**References and conditions:** trace how Ref and conditions affect resource properties and environments.
**Outputs:** review exported values and ensure they contain no secrets.
**Change set:** inspect additions, modifications, removals, interruptions, and replacements. For high-impact resources, check property-specific update documentation and backup/recovery plans.
**After execution:** check stack status, events, actual resources, and application behavior. Do not assume every failure restores every resource to its prior state; inspect what exists now.
When reading a CloudFormation template, follow how sections connect and what effects an update may have before focusing on YAML syntax. Tracing which inputs change resource properties, what outputs reveal, and which changes may replace resources helps balance reuse with update risk.
Sources
[CloudFormation template sections (AWS)](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html)
[CloudFormation Parameters syntax (AWS)](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html)
[CloudFormation Outputs syntax (AWS)](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/outputs-section-structure.html)
[How CloudFormation works and change sets (AWS)](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cloudformation-overview.html)
[CloudFormation change set examples (AWS)](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-changesets-samples.html)