- Template reference: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-reference.html
- Use it to find resource types, properties, return values, and intrinsic functions.
- Other sections (transforms, helper scripts, resource specs and schemas) exist but are out of scope for this lesson.
Intrinsic functions
CloudFormation intrinsic functions let you inject dynamic values into your template. The most frequently used intrinsic function is Ref, which returns a resource or parameter value. Below are practical examples and guidance for common intrinsic functions. Quick intrinsic function overview:| Intrinsic Function | Purpose | Example / Notes |
|---|---|---|
| Ref | Returns a parameter value or a resource’s logical ID or physical name | See Ref examples below |
| Fn::Sub | Substitute variables into a string | Useful for composing names with ${AWS::StackName} |
| Fn::Join | Concatenate a list of values into a single string | Joins arrays with a delimiter |
| Fn::GetAtt | Get an attribute value from a resource | E.g., Fn::GetAtt: [MyResource, Arn] |
| Fn::FindInMap | Retrieve values from a mapping defined in the template | Useful for lookups (region-specific settings) |

- JSON short form
- YAML short form
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html Other intrinsic functions you might use include Fn::Sub, Fn::Join, Fn::GetAtt, and Fn::FindInMap. The intrinsic function reference lists all available functions with JSON/YAML syntax and usage examples: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html.

- JSON form:
- YAML form:
Resource types and properties
Resource types and their properties are documented in the Resource and Property Types reference:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html This reference lists allowed properties, data types, whether properties are required, and update behaviors (for example whether a property change triggers replacement). Always verify the exact property names, types, and update requirements to avoid template errors and unintended resource replacement. Example S3 bucket resource (YAML):
- Verify property names and types against the Resource and Property Types reference.
- Confirm required properties for the resource you are creating.
- Review update behaviors so you understand whether property changes require replacement of the resource.
Always use the template reference to confirm the exact resource properties and data types for the AWS resource you are creating. This will prevent common template errors.
Summary
In this lesson we used the CloudFormation template reference and intrinsic function documentation to validate and improve templates. Key takeaways:- Locate Ref and other intrinsic functions and understand their JSON/YAML forms.
- Use Fn::Sub (and other string functions) when composing resource names or injecting stack values.
- Confirm resource types and properties (for example AWS::S3::Bucket) using the Resource and Property Types reference.
- Check required properties and update behavior to prevent unintended resource replacement.
- CloudFormation Template Reference: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-reference.html
- Intrinsic functions: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html
- Ref function: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html
- Resource and Property Types: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html