J Cole Morrison
J Cole Morrison

J Cole Morrison

Developer Advocate @HashiCorp, DevOps Enthusiast, Startup Lover, Teaching at awsdevops.io



Complete Guides:

CloudFormation Complete Guide

The Complete CloudFormation Guide: Resources

Posted by J Cole Morrison on .

The Complete CloudFormation Guide: Resources

Posted by J Cole Morrison on .

The Complete CloudFormation Guide Resources

Table of Contents

  1. Introduction
  2. What Are We Doing?
  3. The Video: Resources
  4. The Template So Far
  5. Next Steps
  6. The Complete CloudFormation Guide Index

Introduction

As of the previous video, the easy parts of putting together our template are out of the way and now we move into the Resources section.

Out of all of the property sections in a template, this is where you'll do 80-90% of your work. It's complex, sure, but remember our simple workflow from the Main Concepts section to keep yourself on track: we're just finding what we want, picking the properties, and adding it to our template. That and the mental model of imagining how things would look and act in the console will keep us on solid ground if overwhelm starts to kick in.

The thing to keep in mind here is thinking about what the console would ask for when you set up a Security Group through it, and then how to take those steps and put them into the template. We'll work through that process here and, in the end, you might be surprised by just how familiar the code you've written looks compared to what's in the console version.

What Are We Doing?

In this video, we'll get into the general structure that ALL resources generally follow in a AWS CloudFormation template, including the Logical ID and its properties. We'll put this into practice ourselves by using a Security Group as an example as we settle into the workflow between our code editor and the AWS Resource and Property Types Reference documentation.

The Video: Resources

The Template So Far

{
  "AWSTemplateFormatVersion" : "2010-09-09",
  "Description": "A template for learning and security groups",
  "Metadata": {
    "Author": "J Cole Morrison"
  },
  "Resources": {
    "SecurityGroup": {
      "Type": "AWS::EC2::SecurityGroup",
      "Properties": {
        "GroupName": "instance-sg",
        "GroupDescription": "Security group for SSH and HTTP access",
        "SecurityGroupIngress": [
          {
            "IpProtocol": "tcp",
            "FromPort": "80",
            "ToPort": "80",
            "CidrIp": "0.0.0.0/0"
          },
          {
            "IpProtocol": "tcp",
            "FromPort": "22",
            "ToPort": "22",
            "CidrIp": "0.0.0.0/0"
          }
        ]
      }
    }
  }
}

Next Steps

The Next Post - Parameters and Refs

The Previous Post - Our Project Setup

The Complete CloudFormation Guide Index

If you're enjoying this series and finding it useful, be sure to check out the rest of the blog posts in it! The links below will take you to the other posts in The Complete CloudFormation Guide here on Tech Guides and Thoughts so you can continue building your CloudFormation template along with me.

  1. The Complete CloudFormation Guide
  2. An Introduction to and History of CloudFormation
  3. The Main Concepts of CloudFormation
  4. How CloudFormation Does Updates and Deletes
  5. Our Project Setup
  6. Resources
  7. Parameters and Refs
  8. Our First Time Launch
  9. Functions, Pseudo Parameters, and Conditions Part 1
  10. Functions, Pseudo Parameters, and Conditions Part 2
  11. Mappings
  12. Transforms
  13. Outputs
  14. Relaunch!
  15. The Best Next Steps to Take from Here

Enjoy Posts Like These? Sign up to my mailing list!

My Tech Guides and Thoughts Mailing List

J Cole Morrison

J Cole Morrison

http://start.jcolemorrison.com

Developer Advocate @HashiCorp, DevOps Enthusiast, Startup Lover, Teaching at awsdevops.io

View Comments...
J Cole Morrison

J Cole Morrison

Developer Advocate @HashiCorp, DevOps Enthusiast, Startup Lover, Teaching at awsdevops.io



Complete Guides: