Skip to content

AWS CloudFormation: Introduction & Getting Started

AWS CloudFormation Logo

AWS CloudFormation is an infrastructure as code (IaC) service that enables you to define and provision AWS resources using templates written in YAML or JSON.

Why Use CloudFormation?

  • Automate AWS infrastructure deployment
  • Use version-controlled templates for repeatability
  • Integrate with AWS services and CI/CD pipelines

How CloudFormation Works

  • Templates define resources and their relationships
  • Stacks are deployed and managed via the AWS Console, CLI, or API
  • Supports parameters, outputs, and resource dependencies

Quick Start Example

  1. Write a simple template (template.yaml):
    AWSTemplateFormatVersion: '2010-09-09'
    Resources:
      MyBucket:
        Type: AWS::S3::Bucket
    Outputs:
      BucketName:
        Value: !Ref MyBucket
    
  2. Deploy the stack (CLI):
    aws cloudformation create-stack --stack-name my-stack --template-body file://template.yaml
    
  3. Check the stack status:
    aws cloudformation describe-stacks --stack-name my-stack
    

Learn More