AWS Classroomnotes 26/Dec/2021

Creating Infrastructure in AWS

  • To create infra in AWS we have three possible ways
  • Console => Manual
  • CLI => Scripted/Procedural
  • Cloud formation => Infrastructure as Code (IaC) / Declarative
  • AWS Cloud formation is an IaC which helps in provisioning infra at scale declarativly
  • Process of Creating Infra using AWS CloudFormation
  • Identify the resource to be created
  • Identify the variables
  • Author/Write/Create an AWS Cloudformation template in JSON/YAML files
  • Once the template is ready, then create a CloudFormation Stack to deploy the application.
  • Lets try to see one example
    Preview
    Preview
    Preview
    Preview
    Preview
    Preview
    Preview
    Preview
    Preview
  • To deploy word press we have taken some template and created stack, if you have similar template created for your application deployment, will it not be useful for ci/cd and multi environment creations?
  • Once you have finished using your application, we can delete the infra by deleting the stack.
  • Changes can be made in the deployed infra, by updating a template => updating the stack.

Authoring CloudFormation Template

  • Developer Setup:
  • Ensure Visual Studio Code is installed
  • Ensure Cloudformation extension is installed
    Preview
  • Template anatomy: Refer Here for the official docs
  • Cloud formation has a specific structure and the elements are
  • AWSTemplateFormatVersion:
    • This the version of the template schema
    • datatype: string
    • value: “2010-09-09”
  • Description:
    • A text describing your template
  • Metadata:
    • This is an object which provides additional information about the template
  • Parameters:
    • Values to pass at runtime
  • Rules:
    • Validates a parameter or combination of paramters passed to a template during stack creation or updation process
  • Mappings:
    • A mapping of key and associated values
  • Conditions
    • Conditions that control wheter a certian resources are created or not
  • Transform
  • Resources:
    • This is the only required field
    • In this you describe the resource to be created as part of CF Stack creation process.
  • Outputs
  • Lets try to write our first Cloud formation template to create an S3 bucket
  • Manual steps:
    Preview
    Preview
    Preview
  • Lets create a cf template for this.
  • To create s3 bucket the resource has the structure as shown Refer Here
  • Refer Here for the template created & Now create a stack
    Preview
    Preview
    Preview
    Preview
    Preview
    Preview

Leave a Reply

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

About continuous learner

devops & cloud enthusiastic learner