AWS CloudFormation Introuction

Introduction

Infrastructure as Code(IaC)

  • Infrastructure as code is a declarative way of managing infrastructure such as networks, virtual machines, storage etc.
  • IAC also comes with very important principle idempotance. Idempotance ensures it always sets the target environment to same state for the same configuration.

AWS CloudFormation

  • AWS CloudFormation is a IaC for the amazon cloud services.
  • AWS CloudFormation enables to model your entire infrastructure in a simple text files. To be very specific the CloudFormation uses json or yaml

Basic Workflow of CloudFormation

Preview

  • Create a CloudFormation Template in Json/YAML .
  • Upload it to S3 Bucket
  • Create a Stack from the template to provision the infrastructure

Refer here to see how to use the CloudFormation from AWS Console

Terminology

  • Template: Template for the CloudFormation is representation of the infrastructure which has to be provisioned in the JSON/YAML Format.

    • Sample JSON Template
      {
          "Resources" : {
              "DirectDevopsBucket" : {
                  "Type" : "AWS::S3::Bucket",
                  "Properties" : {
                      "AccessControl" : "PublicRead"
                  }
              }
          }
      }
      
    • Sample YAML Template
      Resources:
      DirectDevOpsBucket:
          Type: AWS::S3::Bucket
          Properties:
          AccessControl: PublicRead
      
  • Stacks: All the resources which you manage as a single unit is considered as stack. Preview

    If you observer the section with 3 you can observer stack creating multiple resources

  • StackSets:

    • StackSets allow you to Deploy AWS Resources in multiple regions using a Single CloudFormation Template.
    • Stacksets creates stack in every region you want to create infra.
    • If you edit the stackset, then the change will be updated to all the stacks

Setting up your machine for AWS CloudFormation

Please do the following steps

  1. Install the AWS CLI on your machine by following the links
  2. Install Visual Studio Code Click here
  3. Install CloudFormation Extension to Visual Studio
    • For general help on installing extensions Click Here
    • For info on CloudFormation Extension Click Here

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner