Cloud Formation First Hands On

  CloudFormation

https://www.udemy.com/aws-cloudformation-master-class/learn/v4/t/lecture/8138980?start=0

Main Menu

Section Menu

 

YAML Crash Course

JSON to YAML Converter

  • YAML and JSON both work for CF
    • JSON is horrible, YAML is awsome
  • Key-Value Pairs
    • Delimited by a colon ‘:’
    • Key: Value
      • Values with colons ‘:’ must be enclosed by quotes.
        • “AWS::S3::Bucket”
      • Empty sets noted with Open/Closed curly brackets
        • Tags: {}
  • Nested objects (arrays) signified by tabs (similar to Perl)
    • bill-to:
      • last-name: Roberts
      • first-name: Thomas
  • Support Arrays
    • Delimited by a minus ‘-‘ sign
  • Multi-line strings
    • Delimited by a pipe ‘|’
    • Will display ‘as is’ (auto <br/>??)
    • JSON does not include multi-line strings
  • Can include comments!
    • Delimited by the hash tag ‘#’
    • JSON does not include comments!!
{
   "course":"AWS Lambda",
   "instructor":"Stephane Maarek",
   "instructor-full":{
      "first-name":"Stephane",
      "last-name":"Maarek",
      "awesomeness-level":9000
   },
   "sections-list":[
      "Introduction",
      "Deploying your first function",
      "Learning AWS Lambda in depth",
      "Real world examples"
   ],
   "lectures":[
      {
         "lecture-id":1,
         "lecture-name":"intro",
         "lecture-length":"5:03"
      },
      {
         "lecture-id":2,
         "lecture-name":"aws lambda",
         "lecture-length":"10:47"
      }
   ]
}
---
course: AWS Lambda
instructor: Stephane Maarek
instructor-full:
   first-name: Stephane
   last-name: Maarek
   awesomeness-level: 9000
sections-list:
-  Introduction
-  Deploying your first function
-  Learning AWS Lambda in depth
-  Real world examples
lectures:
-  lecture-id: 1
   lecture-name: intro
   lecture-length: '5:03'
-  lecture-id: 2
   lecture-name: aws lambda
   lecture-length: '10:47'

 

Creating an S3 Bucket

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket.html

---
Resources:
   MyS3Bucket:
      Type: "AWS::S3::Bucket:
      Properties: {}

 

Updating a Resource

https://www.udemy.com/aws-cloudformation-master-class/learn/v4/t/lecture/8138992?start=0

 

Understanding the CloudFormation Template Options

https://www.udemy.com/aws-cloudformation-master-class/learn/v4/t/lecture/8139008?start=0

Parameters that are common to any CloudFormation template

  • These are found on the Provisioning page in the AWS console!
  • Tags
    • Will be applied to all services in the stack
  • Permissions
  • Notification Options
  • Timeouts
  • Rollback on Failure
  • Stack Policy

 

Using the CloudFormation Designer

https://www.udemy.com/aws-cloudformation-master-class/learn/v4/t/lecture/8139016?start=0

  • CloudFormation > [Design template]
  • Drag and drop resources onto the screen
  • Help visualize a CF Stack
  • Handy to quickly draft a template
  • Strong capabilities to verify that your template is well written
  • Right Click and click ‘?’ to get a link directly to the documentation page!

 

CloudFormation Building Blocks

Template Components

  • Resources: AWS resources declared in the template
  • Parameters: Dynamic inputs for your template
  • Mappings: Static variables for your template
  • Outputs: References to what has been created
  • Conditionals: List of conditions to perform resource creation
  • Metadata

Template Helpers

  • References
  • Functions

 

Deploying CloudFormation Templates

  • Manual
    • Editing templates in the CF Desgner
    • Use the console to input parameters, etc.
  • Automated
    • Editing templates in a YAML file
    • Using the AWS CLI to deploy the templates
    • This will be in the Advanced Section

 

Quiz

Updates can sometimes replace resources

  • Yes
  • No

Which of the following is NOT an option while running a new CloudFormation template

  • Tags
  • Permissions
  • Notification Options
  • Timeouts
  • Rollback on Failure
  • Stack Policy
  • Custom Script

Which tool should I use for automating the deployment of CF templates?

  • CF Designer
  • The AWS CLI

 

 

LEAVE A COMMENT