Skip to content

Instantly share code, notes, and snippets.

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 Packet-Lost/e6034247b1f2599f9700b85d5db39e52 to your computer and use it in GitHub Desktop.
Save Packet-Lost/e6034247b1f2599f9700b85d5db39e52 to your computer and use it in GitHub Desktop.
Example CloudFormation Template
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"IGWAttachment": {
"Properties": {
"InternetGatewayId": {
"Ref": "InternetGateway"
},
"VpcId": {
"Ref": "VPC"
}
},
"Type": "AWS::EC2::VPCGatewayAttachment"
},
"IGWRoute": {
"DependsOn": "IGWAttachment",
"Properties": {
"DestinationCidrBlock": "0.0.0.0/0",
"GatewayId": {
"Ref": "InternetGateway"
},
"RouteTableId": {
"Ref": "RouteTable"
}
},
"Type": "AWS::EC2::Route"
},
"InboundNetworkAclEntry": {
"Properties": {
"CidrBlock": "0.0.0.0/0",
"Egress": "false",
"NetworkAclId": {
"Ref": "NetworkAcl"
},
"PortRange": {
"From": "0",
"To": "65535"
},
"Protocol": "-1",
"RuleAction": "allow",
"RuleNumber": "100"
},
"Type": "AWS::EC2::NetworkAclEntry"
},
"InternetGateway": {
"Properties": {
"Tags": [
{
"Key": "Application",
"Value": {
"Ref": "AWS::StackName"
}
},
{
"Key": "Name",
"Value": "us-east-1 Spot Instance VPC IGW"
},
{
"Key": "Network",
"Value": "us-east-1 Spot Instance VPC"
}
]
},
"Type": "AWS::EC2::InternetGateway"
},
"NetworkAcl": {
"Properties": {
"Tags": [
{
"Key": "Application",
"Value": {
"Ref": "AWS::StackName"
}
},
{
"Key": "Network",
"Value": "us-east-1 Spot Instance VPC"
}
],
"VpcId": {
"Ref": "VPC"
}
},
"Type": "AWS::EC2::NetworkAcl"
},
"OutboundNetworkAclEntry": {
"Properties": {
"CidrBlock": "0.0.0.0/0",
"Egress": "true",
"NetworkAclId": {
"Ref": "NetworkAcl"
},
"PortRange": {
"From": "0",
"To": "65535"
},
"Protocol": "-1",
"RuleAction": "allow",
"RuleNumber": "100"
},
"Type": "AWS::EC2::NetworkAclEntry"
},
"PublicSubnet1": {
"Properties": {
"AvailabilityZone": "us-east-1a",
"CidrBlock": "10.100.1.0/24",
"MapPublicIpOnLaunch": "true",
"Tags": [
{
"Key": "Application",
"Value": {
"Ref": "AWS::StackName"
}
},
{
"Key": "Name",
"Value": "Public Subnet 1"
},
{
"Key": "Network",
"Value": "us-east-1 Spot Instance VPC"
}
],
"VpcId": {
"Ref": "VPC"
}
},
"Type": "AWS::EC2::Subnet"
},
"PublicSubnet2": {
"Properties": {
"AvailabilityZone": "us-east-1b",
"CidrBlock": "10.100.2.0/24",
"MapPublicIpOnLaunch": "true",
"Tags": [
{
"Key": "Application",
"Value": {
"Ref": "AWS::StackName"
}
},
{
"Key": "Name",
"Value": "Public Subnet 2"
},
{
"Key": "Network",
"Value": "us-east-1 Spot Instance VPC"
}
],
"VpcId": {
"Ref": "VPC"
}
},
"Type": "AWS::EC2::Subnet"
},
"PublicSubnet3": {
"Properties": {
"AvailabilityZone": "us-east-1c",
"CidrBlock": "10.100.3.0/24",
"MapPublicIpOnLaunch": "true",
"Tags": [
{
"Key": "Application",
"Value": {
"Ref": "AWS::StackName"
}
},
{
"Key": "Name",
"Value": "Public Subnet 3"
},
{
"Key": "Network",
"Value": "us-east-1 Spot Instance VPC"
}
],
"VpcId": {
"Ref": "VPC"
}
},
"Type": "AWS::EC2::Subnet"
},
"PublicSubnet4": {
"Properties": {
"AvailabilityZone": "us-east-1d",
"CidrBlock": "10.100.4.0/24",
"MapPublicIpOnLaunch": "true",
"Tags": [
{
"Key": "Application",
"Value": {
"Ref": "AWS::StackName"
}
},
{
"Key": "Name",
"Value": "Public Subnet 4"
},
{
"Key": "Network",
"Value": "us-east-1 Spot Instance VPC"
}
],
"VpcId": {
"Ref": "VPC"
}
},
"Type": "AWS::EC2::Subnet"
},
"PublicSubnet5": {
"Properties": {
"AvailabilityZone": "us-east-1e",
"CidrBlock": "10.100.5.0/24",
"MapPublicIpOnLaunch": "true",
"Tags": [
{
"Key": "Application",
"Value": {
"Ref": "AWS::StackName"
}
},
{
"Key": "Name",
"Value": "Public Subnet 5"
},
{
"Key": "Network",
"Value": "us-east-1 Spot Instance VPC"
}
],
"VpcId": {
"Ref": "VPC"
}
},
"Type": "AWS::EC2::Subnet"
},
"PublicSubnet6": {
"Properties": {
"AvailabilityZone": "us-east-1f",
"CidrBlock": "10.100.6.0/24",
"MapPublicIpOnLaunch": "true",
"Tags": [
{
"Key": "Application",
"Value": {
"Ref": "AWS::StackName"
}
},
{
"Key": "Name",
"Value": "Public Subnet 6"
},
{
"Key": "Network",
"Value": "us-east-1 Spot Instance VPC"
}
],
"VpcId": {
"Ref": "VPC"
}
},
"Type": "AWS::EC2::Subnet"
},
"RouteTable": {
"Properties": {
"Tags": [
{
"Key": "Application",
"Value": {
"Ref": "AWS::StackName"
}
},
{
"Key": "Name",
"Value": "Public IGW Routing Table"
},
{
"Key": "Network",
"Value": "us-east-1 Spot Instance VPC"
}
],
"VpcId": {
"Ref": "VPC"
}
},
"Type": "AWS::EC2::RouteTable"
},
"SubnetNetworkAclAssociation1": {
"Properties": {
"NetworkAclId": {
"Ref": "NetworkAcl"
},
"SubnetId": {
"Ref": "PublicSubnet1"
}
},
"Type": "AWS::EC2::SubnetNetworkAclAssociation"
},
"SubnetNetworkAclAssociation2": {
"Properties": {
"NetworkAclId": {
"Ref": "NetworkAcl"
},
"SubnetId": {
"Ref": "PublicSubnet2"
}
},
"Type": "AWS::EC2::SubnetNetworkAclAssociation"
},
"SubnetNetworkAclAssociation3": {
"Properties": {
"NetworkAclId": {
"Ref": "NetworkAcl"
},
"SubnetId": {
"Ref": "PublicSubnet3"
}
},
"Type": "AWS::EC2::SubnetNetworkAclAssociation"
},
"SubnetNetworkAclAssociation4": {
"Properties": {
"NetworkAclId": {
"Ref": "NetworkAcl"
},
"SubnetId": {
"Ref": "PublicSubnet4"
}
},
"Type": "AWS::EC2::SubnetNetworkAclAssociation"
},
"SubnetNetworkAclAssociation5": {
"Properties": {
"NetworkAclId": {
"Ref": "NetworkAcl"
},
"SubnetId": {
"Ref": "PublicSubnet5"
}
},
"Type": "AWS::EC2::SubnetNetworkAclAssociation"
},
"SubnetNetworkAclAssociation6": {
"Properties": {
"NetworkAclId": {
"Ref": "NetworkAcl"
},
"SubnetId": {
"Ref": "PublicSubnet6"
}
},
"Type": "AWS::EC2::SubnetNetworkAclAssociation"
},
"SubnetRouteTableAssociation1": {
"Properties": {
"RouteTableId": {
"Ref": "RouteTable"
},
"SubnetId": {
"Ref": "PublicSubnet1"
}
},
"Type": "AWS::EC2::SubnetRouteTableAssociation"
},
"SubnetRouteTableAssociation2": {
"Properties": {
"RouteTableId": {
"Ref": "RouteTable"
},
"SubnetId": {
"Ref": "PublicSubnet2"
}
},
"Type": "AWS::EC2::SubnetRouteTableAssociation"
},
"SubnetRouteTableAssociation3": {
"Properties": {
"RouteTableId": {
"Ref": "RouteTable"
},
"SubnetId": {
"Ref": "PublicSubnet3"
}
},
"Type": "AWS::EC2::SubnetRouteTableAssociation"
},
"SubnetRouteTableAssociation4": {
"Properties": {
"RouteTableId": {
"Ref": "RouteTable"
},
"SubnetId": {
"Ref": "PublicSubnet4"
}
},
"Type": "AWS::EC2::SubnetRouteTableAssociation"
},
"SubnetRouteTableAssociation5": {
"Properties": {
"RouteTableId": {
"Ref": "RouteTable"
},
"SubnetId": {
"Ref": "PublicSubnet5"
}
},
"Type": "AWS::EC2::SubnetRouteTableAssociation"
},
"SubnetRouteTableAssociation6": {
"Properties": {
"RouteTableId": {
"Ref": "RouteTable"
},
"SubnetId": {
"Ref": "PublicSubnet6"
}
},
"Type": "AWS::EC2::SubnetRouteTableAssociation"
},
"VPC": {
"Properties": {
"CidrBlock": "10.100.0.0/16",
"EnableDnsHostnames": "true",
"EnableDnsSupport": "true",
"Tags": [
{
"Key": "Application",
"Value": {
"Ref": "AWS::StackName"
}
},
{
"Key": "Name",
"Value": "us-east-1 Spot Instance VPC"
},
{
"Key": "Network",
"Value": "us-east-1 Spot Instance VPC"
}
]
},
"Type": "AWS::EC2::VPC"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment