Skip to content

Instantly share code, notes, and snippets.

@clstl
Created January 9, 2017 08:48
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 clstl/4909a645ef08e8a637a1f63e2cc4b4d2 to your computer and use it in GitHub Desktop.
Save clstl/4909a645ef08e8a637a1f63e2cc4b4d2 to your computer and use it in GitHub Desktop.
{
"VPC": {
"Type": "AWS::EC2::VPC",
"Properties": {
"CidrBlock": "10.0.0.0/16",
"EnableDnsSupport": true,
"EnableDnsHostnames": true,
"InstanceTenancy": "default",
"Tags": [{
"Key": "Name",
"Value": "10.0.0.0/16"
}]
}
},
"InternetGateway": {
"Type": "AWS::EC2::InternetGateway",
"Properties": {
"Tags": [{
"Key": "Name",
"Value": "10.0.0.0/16"
}]
}
},
"VPCGatewayAttachment": {
"Type": "AWS::EC2::VPCGatewayAttachment",
"Properties": {
"VpcId": {"Ref": "VPC"},
"InternetGatewayId": {"Ref": "InternetGateway"}
}
},
"SubnetAPublic": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"AvailabilityZone": {"Fn::Select": ["0", {"Fn::GetAZs": ""}]},
"CidrBlock": "10.0.0.0/20",
"MapPublicIpOnLaunch": true,
"VpcId": {"Ref": "VPC"},
"Tags": [{
"Key": "Name",
"Value": "A public"
}, {
"Key": "Reach",
"Value": "public"
}]
}
},
"SubnetAPrivate": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"AvailabilityZone": {"Fn::Select": ["0", {"Fn::GetAZs": ""}]},
"CidrBlock": "10.0.16.0/20",
"VpcId": {"Ref": "VPC"},
"Tags": [{
"Key": "Name",
"Value": "A private"
}, {
"Key": "Reach",
"Value": "private"
}]
}
},
"RouteTableAssociationAPublic": {
"Type": "AWS::EC2::SubnetRouteTableAssociation",
"Properties": {
"SubnetId": {"Ref": "SubnetAPublic"},
"RouteTableId": {"Ref": "RouteTablePublic"}
}
},
"RouteTableAssociationAPrivate": {
"Type": "AWS::EC2::SubnetRouteTableAssociation",
"Properties": {
"SubnetId": {"Ref": "SubnetAPrivate"},
"RouteTableId": {"Ref": "RouteTablePrivate"}
}
},
"SubnetNetworkAclAssociationAPublic": {
"Type": "AWS::EC2::SubnetNetworkAclAssociation",
"Properties": {
"SubnetId": {"Ref": "SubnetAPublic"},
"NetworkAclId": {"Ref": "NetworkAclPublic"}
}
},
"SubnetNetworkAclAssociationAPrivate": {
"Type": "AWS::EC2::SubnetNetworkAclAssociation",
"Properties": {
"SubnetId": {"Ref": "SubnetAPrivate"},
"NetworkAclId": {"Ref": "NetworkAclPrivate"}
}
},
"RouteTablePublic": {
"Type": "AWS::EC2::RouteTable",
"Properties": {
"VpcId": {"Ref": "VPC"},
"Tags": [{
"Key": "Name",
"Value": "Public"
}]
}
},
"RouteTablePrivate": {
"Type": "AWS::EC2::RouteTable",
"Properties": {
"VpcId": {"Ref": "VPC"},
"Tags": [{
"Key": "Name",
"Value": "Private"
}]
}
},
"RouteTablePublicInternetRoute": {
"Type": "AWS::EC2::Route",
"DependsOn": "VPCGatewayAttachment",
"Properties": {
"RouteTableId": {"Ref": "RouteTablePublic"},
"DestinationCidrBlock": "0.0.0.0/0",
"GatewayId": {"Ref": "InternetGateway"}
}
},
"NetworkAclPublic": {
"Type": "AWS::EC2::NetworkAcl",
"Properties": {
"VpcId": {"Ref": "VPC"},
"Tags": [{
"Key": "Name",
"Value": "Public"
}]
}
},
"NetworkAclPrivate": {
"Type": "AWS::EC2::NetworkAcl",
"Properties": {
"VpcId": {"Ref": "VPC"},
"Tags": [{
"Key": "Name",
"Value": "Private"
}]
}
},
"NetworkAclEntryInPublicAllowAll": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {"Ref": "NetworkAclPublic"},
"RuleNumber": "99",
"Protocol": "-1",
"RuleAction": "allow",
"Egress": "false",
"CidrBlock": "0.0.0.0/0"
}
},
"NetworkAclEntryOutPublicAllowAll": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {"Ref": "NetworkAclPublic"},
"RuleNumber": "99",
"Protocol": "-1",
"RuleAction": "allow",
"Egress": "true",
"CidrBlock": "0.0.0.0/0"
}
},
"NetworkAclEntryInPrivateAllowVPC": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {"Ref": "NetworkAclPrivate"},
"RuleNumber": "99",
"Protocol": "-1",
"RuleAction": "allow",
"Egress": "false",
"CidrBlock": "0.0.0.0/0"
}
},
"NetworkAclEntryOutPrivateAllowVPC": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {"Ref": "NetworkAclPrivate"},
"RuleNumber": "99",
"Protocol": "-1",
"RuleAction": "allow",
"Egress": "true",
"CidrBlock": "0.0.0.0/0"
}
},
"LambdaExecSecurityGroup": {
"Type": "AWS::EC2::SecurityGroup",
"Properties" : {
"GroupDescription": "Lambda functions execute with this group",
"VpcId": {"Ref": "VPC"},
"Tags" : [{
"Key": "Name",
"Value": "LambdaExecSecurityGroup"
}]
}
},
"SchedulingCacheSubnetGroup":{
"Type" : "AWS::ElastiCache::SubnetGroup",
"Properties" : {
"CacheSubnetGroupName" : "SchedulingCacheSubnetGroup",
"Description" : "Subnet for the Cache",
"SubnetIds" : [ {"Ref": "SubnetAPrivate"} ]
}
},
"SchedulingCache": {
"Type": "AWS::ElastiCache::CacheCluster",
"Properties": {
"CacheNodeType": "cache.t2.micro",
"Engine": "redis",
"NumCacheNodes": 1,
"VpcSecurityGroupIds": [ { "Ref": "LambdaExecSecurityGroup"} ],
"CacheSubnetGroupName": { "Ref": "SchedulingCacheSubnetGroup" }
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment