Skip to content

Instantly share code, notes, and snippets.

@twasink
Created January 15, 2019 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twasink/951ad2f66921970f1bb1b84da25f7a42 to your computer and use it in GitHub Desktop.
Save twasink/951ad2f66921970f1bb1b84da25f7a42 to your computer and use it in GitHub Desktop.
Baby's First CloudFormation Stack
---
AWSTemplateFormatVersion: '2010-09-09'
Description:
Global configuration that could be used by multiple related stacks
# Metadata: # no metadata
Parameters:
Environment:
Type: String
Description:
Stack Environment Prefix.
Resources:
# We need at least one resource. The VPC is the logical one to include here.
VPC:
Type: AWS::EC2::VPC
Properties:
# The range of ip addresses used in the VPC. Subnets will be inside this.
# Using the /16 lets me easily have subnets that don't overlap without
# needing to remember bit masks.
CidrBlock: 10.0.0.0/16 # 10.0.0.0 -> 10.0.255.255
EnableDnsSupport: true # If false, the servers don't seem to get access to DNS at all.
InstanceTenancy: default
Tags:
- Key: Name
Value: !Sub "${Environment} VPC"
Outputs:
VPC:
Description: The ID for the Virtual Private Cloud; needed by more or less everything.
Value: !Ref VPC
Export:
Name: !Sub "${Environment}::VPC"
@twasink
Copy link
Author

twasink commented Jan 15, 2019

An example 'global' CloudFormation stack, defining resources that we don't want to have to remove and recreate unnecessarily. See https://twasink.net/2019/01/11/ail-babys-first-cloudformation-stack/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment