Template anatomy
Resources, and the sections around them.
A CloudFormation template is a structured document — YAML (preferred, readable) or JSON — with a fixed set of top-level sections. Only Resources is required; the rest are optional scaffolding around it. Resources is where you declare each AWS resource by a logical ID, its Type (the AWS resource kind), and its Properties. References between resources build the dependency graph, exactly like other IaC tools.
AWSTemplateFormatVersion: "2010-09-09"Description: A logging bucket with versioningResources:LogsBucket:Type: AWS::S3::BucketProperties:BucketName: acme-logs-prodVersioningConfiguration:Status: EnabledPublicAccessBlockConfiguration:BlockPublicAcls: trueBlockPublicPolicy: trueIgnorePublicAcls: trueRestrictPublicBuckets: true
The sections around Resources
The optional sections make a template reusable and expressive: Parameters take input at deploy time, Mappings are lookup tables (e.g. AMI per region), Conditions gate whether resources are created, Outputs export values (and can be imported by other stacks), and Metadata/Transform add tooling hints and macros. You will meet each, but the mental model is: Resources is the what, everything else shapes how it is parameterized and wired.