Skip to content

Instantly share code, notes, and snippets.

@cuongtv2004
Last active June 14, 2019 19:07
Show Gist options
  • Save cuongtv2004/f3837a40f4d70fc6ebc45f7b298d80a0 to your computer and use it in GitHub Desktop.
Save cuongtv2004/f3837a40f4d70fc6ebc45f7b298d80a0 to your computer and use it in GitHub Desktop.
CloudFormation
"myAutoScale": {
"Type": "AWS::AutoScaling::AutoScalingGroup",
"Properties": {
"LaunchConfigurationName": {
"Ref": "myLaunchConfig"
},
"MinSize": "1",
"MaxSize": "3",
"TargetGroupARNs": [
{
"Ref": "myTargetGroup"
}
],
"VPCZoneIdentifier": [
{
"Ref": "myPrivateSubnetb"
},
{
"Ref": "myPrivateSubneta"
}
]
},
"CreationPolicy": {
"ResourceSignal": {
"Timeout": "PT15M",
"Count": "0"
}
},
"UpdatePolicy": {
"AutoScalingRollingUpdate": {
"MinInstancesInService": "1",
"MaxBatchSize": "1",
"PauseTime": "PT15M",
"WaitOnResourceSignals": "true"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "54521c54-03ab-4448-aa6b-a457fc25ec8f"
}
}
},
"myLaunchConfig": {
"Type": "AWS::AutoScaling::LaunchConfiguration",
"Properties": {
"KeyName": {
"Ref": "KeyName"
},
"ImageId": {
"Fn::FindInMap": [
"AWSRegionArch2AMI",
{
"Ref": "AWS::Region"
},
{
"Fn::FindInMap": [
"AWSInstanceType2Arch",
{
"Ref": "InstanceType"
},
"Arch"
]
}
]
},
"SecurityGroups": [
{
"Ref": "mySecurityGroupWeb"
}
],
"InstanceType": {
"Ref": "InstanceType"
},
"UserData": {
"Fn::Base64": {
"Fn::Join": [
"\n",
[
"#!/bin/bash",
"sudo yum install -y nginx",
"sudo /etc/init.d/nginx start",
"sudo chkconfig nginx on"
]
]
}
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "cb43013f-b624-443e-86a0-e3e89efda20f"
}
}
},
"WebServerScaleUpPolicy": {
"Type": "AWS::AutoScaling::ScalingPolicy",
"Properties": {
"AdjustmentType": "ChangeInCapacity",
"AutoScalingGroupName": {
"Ref": "myAutoScale"
},
"Cooldown": "60",
"ScalingAdjustment": "1"
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "2da211ac-a620-4286-a556-c19c00100b7f"
}
}
},
"WebServerScaleDownPolicy": {
"Type": "AWS::AutoScaling::ScalingPolicy",
"Properties": {
"AdjustmentType": "ChangeInCapacity",
"AutoScalingGroupName": {
"Ref": "myAutoScale"
},
"Cooldown": "60",
"ScalingAdjustment": "-1"
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "f4beb3e0-4854-44eb-a0ba-bf36e744f110"
}
}
},
"CPUAlarmHigh": {
"Type": "AWS::CloudWatch::Alarm",
"Properties": {
"AlarmDescription": "Scale-up if CPU > 80% for 10 minutes",
"MetricName": "CPUUtilization",
"Namespace": "AWS/EC2",
"Statistic": "Average",
"Period": "300",
"EvaluationPeriods": "2",
"Threshold": "80",
"AlarmActions": [
{
"Ref": "WebServerScaleUpPolicy"
}
],
"Dimensions": [
{
"Name": "AutoScalingGroupName",
"Value": {
"Ref": "myAutoScale"
}
}
],
"ComparisonOperator": "GreaterThanThreshold"
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "1536bd1f-db3e-44d7-a52d-868b1f0efa70"
}
}
},
"CPUAlarmLow": {
"Type": "AWS::CloudWatch::Alarm",
"Properties": {
"AlarmDescription": "Scale-down if CPU < 40% for 10 minutes",
"MetricName": "CPUUtilization",
"Namespace": "AWS/EC2",
"Statistic": "Average",
"Period": "300",
"EvaluationPeriods": "2",
"Threshold": "40",
"AlarmActions": [
{
"Ref": "WebServerScaleDownPolicy"
}
],
"Dimensions": [
{
"Name": "AutoScalingGroupName",
"Value": {
"Ref": "myAutoScale"
}
}
],
"ComparisonOperator": "LessThanThreshold"
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "0e863782-be74-48da-8c31-cf3c81b7ab23"
}
}
},
"myBastionHost": {
"Type": "AWS::EC2::Instance",
"Properties": {
"InstanceType": {
"Ref": "BastionInstanceType"
},
"ImageId": {
"Fn::FindInMap": [
"AWSRegionArch2AMI",
{
"Ref": "AWS::Region"
},
{
"Fn::FindInMap": [
"AWSInstanceType2Arch",
{
"Ref": "BastionInstanceType"
},
"Arch"
]
}
]
},
"KeyName": {
"Ref": "KeyName"
},
"NetworkInterfaces": [
{
"GroupSet": [
{
"Ref": "mySecurityGroupBastion"
}
],
"AssociatePublicIpAddress": "true",
"DeviceIndex": "0",
"DeleteOnTermination": "true",
"SubnetId": {
"Ref": "myPublicSubneta"
}
}
]
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "89fdd50e-e0ea-4b34-b268-6f426c674134"
}
}
}
"myTargetGroup": {
"Type": "AWS::ElasticLoadBalancingV2::TargetGroup",
"Properties": {
"HealthCheckIntervalSeconds": 30,
"HealthCheckProtocol": "HTTP",
"HealthCheckTimeoutSeconds": 10,
"HealthyThresholdCount": 4,
"UnhealthyThresholdCount": 3,
"HealthCheckPath": "/",
"VpcId": {
"Ref": "myVPC"
},
"Matcher": {
"HttpCode": "200"
},
"Name": "MyTargets",
"Port": 80,
"Protocol": "HTTP",
"TargetGroupAttributes": [
{
"Key": "deregistration_delay.timeout_seconds",
"Value": "20"
}
]
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "d4b1c4ad-d313-4634-ae28-0919ea392206"
}
}
},
"myLoadBalancer": {
"Type": "AWS::ElasticLoadBalancingV2::LoadBalancer",
"Properties": {
"SecurityGroups": [
{
"Ref": "mySecurityGroupELB"
}
],
"Tags": [
{
"Key": "Name",
"Value": "LoadBalancer"
}
],
"Subnets" : [ {"Ref": "myPublicSubneta"}, {"Ref" : "myPublicSubnetb"}]
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "58eecc93-8865-4c76-b623-4b316a03633b"
}
},
"DependsOn": [
"myPublicSubneta",
"myPublicSubnetb"
]
},
"myListener": {
"Type": "AWS::ElasticLoadBalancingV2::Listener",
"Properties": {
"DefaultActions": [
{
"Type": "forward",
"TargetGroupArn": {
"Ref": "myTargetGroup"
}
}
],
"LoadBalancerArn": {
"Ref": "myLoadBalancer"
},
"Port": "80",
"Protocol": "HTTP"
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "dab73fef-8539-4ca1-9ef6-a538b9bf7d6e"
}
}
},
"myPrivateNetworkACL": {
"Type": "AWS::EC2::NetworkAcl",
"Properties": {
"VpcId": {
"Ref": "myVPC"
},
"Tags": [
{
"Key": "Name",
"Value": "PrivateNetworkAcl"
}
]
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "5407f1df-4c9c-4e13-90e0-2a9043d3b112"
}
},
"DependsOn": [
"myVPC"
]
},
"myPrivateNetworkAclEntry1": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {
"Ref": "myPrivateNetworkACL"
},
"RuleNumber": "100",
"Protocol": "6",
"RuleAction": "allow",
"Egress": "false",
"CidrBlock": "0.0.0.0/0",
"PortRange": {
"From": "80",
"To": "80"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "1e268c9f-3466-4c41-a7ed-879b6ca99460"
}
},
"DependsOn": [
"myPrivateNetworkACL"
]
},
"myPrivateNetworkAclEntry2": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {
"Ref": "myPrivateNetworkACL"
},
"RuleNumber": "110",
"Protocol": "6",
"RuleAction": "allow",
"Egress": "false",
"CidrBlock": "0.0.0.0/0",
"PortRange": {
"From": "443",
"To": "443"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "e4a7009e-ce5f-4f67-951f-f21fc9058038"
}
},
"DependsOn": [
"myPrivateNetworkACL"
]
},
"myPrivateNetworkAclEntry3": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {
"Ref": "myPrivateNetworkACL"
},
"RuleNumber": "120",
"Protocol": "6",
"RuleAction": "allow",
"Egress": "false",
"CidrBlock": "10.0.0.0/16",
"PortRange": {
"From": "22",
"To": "22"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "542baaec-9c0f-4a44-8c5c-060dac2bf95c"
}
},
"DependsOn": [
"myPrivateNetworkACL"
]
},
"myPrivateNetworkAclEntry4": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {
"Ref": "myPrivateNetworkACL"
},
"RuleNumber": "130",
"Protocol": "6",
"RuleAction": "allow",
"Egress": "false",
"CidrBlock": "10.0.0.0/16",
"PortRange": {
"From": "3306",
"To": "3306"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "542baaec-9c0f-4a44-8c5c-060dac2bf95c"
}
},
"DependsOn": [
"myPrivateNetworkACL"
]
},
"myPrivateNetworkAclEntry5": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {
"Ref": "myPrivateNetworkACL"
},
"RuleNumber": "140",
"Protocol": "6",
"RuleAction": "allow",
"Egress": "false",
"CidrBlock": "0.0.0.0/0",
"PortRange": {
"From": "32768",
"To": "65535"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "542baaec-9c0f-4a44-8c5c-060dac2bf95c"
}
},
"DependsOn": [
"myPrivateNetworkACL"
]
},
"myPrivateNetworkAclEntry6": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {
"Ref": "myPrivateNetworkACL"
},
"RuleNumber": "150",
"Protocol": "17",
"RuleAction": "allow",
"Egress": "false",
"CidrBlock": "0.0.0.0/0",
"PortRange": {
"From": "32768",
"To": "65535"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "542baaec-9c0f-4a44-8c5c-060dac2bf95c"
}
},
"DependsOn": [
"myPrivateNetworkACL"
]
},
"myPrivateNetworkAclEntry7": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {
"Ref": "myPrivateNetworkACL"
},
"RuleNumber": "100",
"Protocol": "6",
"RuleAction": "allow",
"Egress": "true",
"CidrBlock": "0.0.0.0/0",
"PortRange": {
"From": "80",
"To": "80"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "542baaec-9c0f-4a44-8c5c-060dac2bf95c"
}
},
"DependsOn": [
"myPrivateNetworkACL"
]
},
"myPrivateNetworkAclEntry8": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {
"Ref": "myPrivateNetworkACL"
},
"RuleNumber": "110",
"Protocol": "6",
"RuleAction": "allow",
"Egress": "true",
"CidrBlock": "0.0.0.0/0",
"PortRange": {
"From": "443",
"To": "443"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "542baaec-9c0f-4a44-8c5c-060dac2bf95c"
}
},
"DependsOn": [
"myPrivateNetworkACL"
]
},
"myPrivateNetworkAclEntry9": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {
"Ref": "myPrivateNetworkACL"
},
"RuleNumber": "120",
"Protocol": "6",
"RuleAction": "allow",
"Egress": "true",
"CidrBlock": "0.0.0.0/0",
"PortRange": {
"From": "22",
"To": "22"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "542baaec-9c0f-4a44-8c5c-060dac2bf95c"
}
},
"DependsOn": [
"myPrivateNetworkACL"
]
},
"myPrivateNetworkAclEntry10": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {
"Ref": "myPrivateNetworkACL"
},
"RuleNumber": "130",
"Protocol": "17",
"RuleAction": "allow",
"Egress": "true",
"CidrBlock": "0.0.0.0/0",
"PortRange": {
"From": "123",
"To": "123"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "542baaec-9c0f-4a44-8c5c-060dac2bf95c"
}
},
"DependsOn": [
"myPrivateNetworkACL"
]
},
"myPrivateNetworkAclEntry11": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {
"Ref": "myPrivateNetworkACL"
},
"RuleNumber": "140",
"Protocol": "6",
"RuleAction": "allow",
"Egress": "true",
"CidrBlock": "0.0.0.0/0",
"PortRange": {
"From": "32768",
"To": "65535"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "542baaec-9c0f-4a44-8c5c-060dac2bf95c"
}
},
"DependsOn": [
"myPrivateNetworkACL"
]
},
"myNetworkACL": {
"Type": "AWS::EC2::NetworkAcl",
"Properties": {
"VpcId": {
"Ref": "myVPC"
},
"Tags": [
{
"Key": "Name",
"Value": "NetworkAcl"
}
]
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "5407f1df-4c9c-4e13-90e0-2a9043d3b112"
}
},
"DependsOn": [
"myVPC"
]
},
"myNetworkAclEntry1": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {
"Ref": "myNetworkACL"
},
"RuleNumber": "100",
"Protocol": "6",
"RuleAction": "allow",
"Egress": "false",
"CidrBlock": "0.0.0.0/0",
"PortRange": {
"From": "80",
"To": "80"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "1e268c9f-3466-4c41-a7ed-879b6ca99460"
}
},
"DependsOn": [
"myNetworkACL"
]
},
"myNetworkAclEntry2": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {
"Ref": "myNetworkACL"
},
"RuleNumber": "110",
"Protocol": "6",
"RuleAction": "allow",
"Egress": "false",
"CidrBlock": "0.0.0.0/0",
"PortRange": {
"From": "443",
"To": "443"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "e4a7009e-ce5f-4f67-951f-f21fc9058038"
}
},
"DependsOn": [
"myNetworkACL"
]
},
"myNetworkAclEntry3": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {
"Ref": "myNetworkACL"
},
"RuleNumber": "120",
"Protocol": "6",
"RuleAction": "allow",
"Egress": "false",
"CidrBlock": "0.0.0.0/0",
"PortRange": {
"From": "22",
"To": "22"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "542baaec-9c0f-4a44-8c5c-060dac2bf95c"
}
},
"DependsOn": [
"myNetworkACL"
]
},
"myNetworkAclEntry4": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {
"Ref": "myNetworkACL"
},
"RuleNumber": "130",
"Protocol": "6",
"RuleAction": "allow",
"Egress": "false",
"CidrBlock": "10.0.0.0/16",
"PortRange": {
"From": "3306",
"To": "3306"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "542baaec-9c0f-4a44-8c5c-060dac2bf95c"
}
},
"DependsOn": [
"myNetworkACL"
]
},
"myNetworkAclEntry5": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {
"Ref": "myNetworkACL"
},
"RuleNumber": "140",
"Protocol": "6",
"RuleAction": "allow",
"Egress": "false",
"CidrBlock": "0.0.0.0/0",
"PortRange": {
"From": "32768",
"To": "65535"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "542baaec-9c0f-4a44-8c5c-060dac2bf95c"
}
},
"DependsOn": [
"myNetworkACL"
]
},
"myNetworkAclEntry6": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {
"Ref": "myNetworkACL"
},
"RuleNumber": "150",
"Protocol": "17",
"RuleAction": "allow",
"Egress": "false",
"CidrBlock": "0.0.0.0/0",
"PortRange": {
"From": "32768",
"To": "65535"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "542baaec-9c0f-4a44-8c5c-060dac2bf95c"
}
},
"DependsOn": [
"myNetworkACL"
]
},
"myNetworkAclEntry7": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {
"Ref": "myNetworkACL"
},
"RuleNumber": "100",
"Protocol": "6",
"RuleAction": "allow",
"Egress": "true",
"CidrBlock": "0.0.0.0/0",
"PortRange": {
"From": "80",
"To": "80"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "542baaec-9c0f-4a44-8c5c-060dac2bf95c"
}
},
"DependsOn": [
"myNetworkACL"
]
},
"myNetworkAclEntry8": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {
"Ref": "myNetworkACL"
},
"RuleNumber": "110",
"Protocol": "6",
"RuleAction": "allow",
"Egress": "true",
"CidrBlock": "0.0.0.0/0",
"PortRange": {
"From": "443",
"To": "443"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "542baaec-9c0f-4a44-8c5c-060dac2bf95c"
}
},
"DependsOn": [
"myNetworkACL"
]
},
"myNetworkAclEntry9": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {
"Ref": "myNetworkACL"
},
"RuleNumber": "120",
"Protocol": "6",
"RuleAction": "allow",
"Egress": "true",
"CidrBlock": "0.0.0.0/0",
"PortRange": {
"From": "22",
"To": "22"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "542baaec-9c0f-4a44-8c5c-060dac2bf95c"
}
},
"DependsOn": [
"myNetworkACL"
]
},
"myNetworkAclEntry10": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {
"Ref": "myNetworkACL"
},
"RuleNumber": "130",
"Protocol": "17",
"RuleAction": "allow",
"Egress": "true",
"CidrBlock": "0.0.0.0/0",
"PortRange": {
"From": "123",
"To": "123"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "542baaec-9c0f-4a44-8c5c-060dac2bf95c"
}
},
"DependsOn": [
"myNetworkACL"
]
},
"myNetworkAclEntry11": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {
"Ref": "myNetworkACL"
},
"RuleNumber": "140",
"Protocol": "6",
"RuleAction": "allow",
"Egress": "true",
"CidrBlock": "0.0.0.0/0",
"PortRange": {
"From": "32768",
"To": "65535"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "542baaec-9c0f-4a44-8c5c-060dac2bf95c"
}
},
"DependsOn": [
"myNetworkACL"
]
},
"myNetworkAclEntry12": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {
"Ref": "myNetworkACL"
},
"RuleNumber": "160",
"Protocol": "17",
"RuleAction": "allow",
"Egress": "false",
"CidrBlock": "10.0.0.0/16",
"PortRange": {
"From": "123",
"To": "123"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "542baaec-9c0f-4a44-8c5c-060dac2bf95c"
}
},
"DependsOn": [
"myNetworkACL"
]
},
"Parameters": {
"InstanceType": {
"Description": "WebServer EC2 instance type",
"Type": "String",
"Default": "t2.micro",
"AllowedValues": [
"t1.micro",
"t2.micro",
"t2.small",
"t2.medium",
"m1.small",
"m1.medium",
"m1.large",
"m1.xlarge",
"m2.xlarge",
"m2.2xlarge",
"m2.4xlarge",
"m3.medium",
"m3.large",
"m3.xlarge",
"m3.2xlarge",
"c1.medium",
"c1.xlarge",
"c3.large",
"c3.xlarge",
"c3.2xlarge",
"c3.4xlarge",
"c3.8xlarge",
"c4.large",
"c4.xlarge",
"c4.2xlarge",
"c4.4xlarge",
"c4.8xlarge",
"g2.2xlarge",
"r3.large",
"r3.xlarge",
"r3.2xlarge",
"r3.4xlarge",
"r3.8xlarge",
"i2.xlarge",
"i2.2xlarge",
"i2.4xlarge",
"i2.8xlarge",
"d2.xlarge",
"d2.2xlarge",
"d2.4xlarge",
"d2.8xlarge",
"hi1.4xlarge",
"hs1.8xlarge",
"cr1.8xlarge",
"cc2.8xlarge",
"cg1.4xlarge"
],
"ConstraintDescription": "must be a valid EC2 instance type."
},
"KeyName": {
"Description": "Name of an EC2 KeyPair to enable SSH access to the instance.",
"Type": "AWS::EC2::KeyPair::KeyName",
"ConstraintDescription": "must be the name of an existing EC2 KeyPair."
}
},
"Mappings": {
"Region2Examples": {
"us-east-1": {
"Examples": "https://s3.amazonaws.com/cloudformation-examples-us-east-1"
},
"us-west-2": {
"Examples": "https://s3-us-west-2.amazonaws.com/cloudformation-examples-us-west-2"
},
"us-west-1": {
"Examples": "https://s3-us-west-1.amazonaws.com/cloudformation-examples-us-west-1"
},
"eu-west-1": {
"Examples": "https://s3-eu-west-1.amazonaws.com/cloudformation-examples-eu-west-1"
},
"eu-west-2": {
"Examples": "https://s3-eu-west-2.amazonaws.com/cloudformation-examples-eu-west-2"
},
"eu-central-1": {
"Examples": "https://s3-eu-central-1.amazonaws.com/cloudformation-examples-eu-central-1"
},
"ap-southeast-1": {
"Examples": "https://s3-ap-southeast-1.amazonaws.com/cloudformation-examples-ap-southeast-1"
},
"ap-northeast-1": {
"Examples": "https://s3-ap-northeast-1.amazonaws.com/cloudformation-examples-ap-northeast-1"
},
"ap-northeast-2": {
"Examples": "https://s3-ap-northeast-2.amazonaws.com/cloudformation-examples-ap-northeast-2"
},
"ap-southeast-2": {
"Examples": "https://s3-ap-southeast-2.amazonaws.com/cloudformation-examples-ap-southeast-2"
},
"ap-south-1": {
"Examples": "https://s3-ap-south-1.amazonaws.com/cloudformation-examples-ap-south-1"
},
"us-east-2": {
"Examples": "https://s3-us-east-2.amazonaws.com/cloudformation-examples-us-east-2"
},
"ca-central-1": {
"Examples": "https://s3-ca-central-1.amazonaws.com/cloudformation-examples-ca-central-1"
},
"sa-east-1": {
"Examples": "https://s3-sa-east-1.amazonaws.com/cloudformation-examples-sa-east-1"
},
"cn-north-1": {
"Examples": "https://s3.cn-north-1.amazonaws.com.cn/cloudformation-examples-cn-north-1"
}
},
"AWSInstanceType2Arch": {
"t1.micro": {
"Arch": "PV64"
},
"t2.nano": {
"Arch": "HVM64"
},
"t2.micro": {
"Arch": "HVM64"
},
"t2.small": {
"Arch": "HVM64"
},
"t2.medium": {
"Arch": "HVM64"
},
"t2.large": {
"Arch": "HVM64"
},
"m1.small": {
"Arch": "PV64"
},
"m1.medium": {
"Arch": "PV64"
},
"m1.large": {
"Arch": "PV64"
},
"m1.xlarge": {
"Arch": "PV64"
},
"m2.xlarge": {
"Arch": "PV64"
},
"m2.2xlarge": {
"Arch": "PV64"
},
"m2.4xlarge": {
"Arch": "PV64"
},
"m3.medium": {
"Arch": "HVM64"
},
"m3.large": {
"Arch": "HVM64"
},
"m3.xlarge": {
"Arch": "HVM64"
},
"m3.2xlarge": {
"Arch": "HVM64"
},
"m4.large": {
"Arch": "HVM64"
},
"m4.xlarge": {
"Arch": "HVM64"
},
"m4.2xlarge": {
"Arch": "HVM64"
},
"m4.4xlarge": {
"Arch": "HVM64"
},
"m4.10xlarge": {
"Arch": "HVM64"
},
"c1.medium": {
"Arch": "PV64"
},
"c1.xlarge": {
"Arch": "PV64"
},
"c3.large": {
"Arch": "HVM64"
},
"c3.xlarge": {
"Arch": "HVM64"
},
"c3.2xlarge": {
"Arch": "HVM64"
},
"c3.4xlarge": {
"Arch": "HVM64"
},
"c3.8xlarge": {
"Arch": "HVM64"
},
"c4.large": {
"Arch": "HVM64"
},
"c4.xlarge": {
"Arch": "HVM64"
},
"c4.2xlarge": {
"Arch": "HVM64"
},
"c4.4xlarge": {
"Arch": "HVM64"
},
"c4.8xlarge": {
"Arch": "HVM64"
},
"g2.2xlarge": {
"Arch": "HVMG2"
},
"g2.8xlarge": {
"Arch": "HVMG2"
},
"r3.large": {
"Arch": "HVM64"
},
"r3.xlarge": {
"Arch": "HVM64"
},
"r3.2xlarge": {
"Arch": "HVM64"
},
"r3.4xlarge": {
"Arch": "HVM64"
},
"r3.8xlarge": {
"Arch": "HVM64"
},
"i2.xlarge": {
"Arch": "HVM64"
},
"i2.2xlarge": {
"Arch": "HVM64"
},
"i2.4xlarge": {
"Arch": "HVM64"
},
"i2.8xlarge": {
"Arch": "HVM64"
},
"d2.xlarge": {
"Arch": "HVM64"
},
"d2.2xlarge": {
"Arch": "HVM64"
},
"d2.4xlarge": {
"Arch": "HVM64"
},
"d2.8xlarge": {
"Arch": "HVM64"
},
"hi1.4xlarge": {
"Arch": "HVM64"
},
"hs1.8xlarge": {
"Arch": "HVM64"
},
"cr1.8xlarge": {
"Arch": "HVM64"
},
"cc2.8xlarge": {
"Arch": "HVM64"
}
},
"AWSInstanceType2NATArch": {
"t1.micro": {
"Arch": "NATPV64"
},
"t2.nano": {
"Arch": "NATHVM64"
},
"t2.micro": {
"Arch": "NATHVM64"
},
"t2.small": {
"Arch": "NATHVM64"
},
"t2.medium": {
"Arch": "NATHVM64"
},
"t2.large": {
"Arch": "NATHVM64"
},
"m1.small": {
"Arch": "NATPV64"
},
"m1.medium": {
"Arch": "NATPV64"
},
"m1.large": {
"Arch": "NATPV64"
},
"m1.xlarge": {
"Arch": "NATPV64"
},
"m2.xlarge": {
"Arch": "NATPV64"
},
"m2.2xlarge": {
"Arch": "NATPV64"
},
"m2.4xlarge": {
"Arch": "NATPV64"
},
"m3.medium": {
"Arch": "NATHVM64"
},
"m3.large": {
"Arch": "NATHVM64"
},
"m3.xlarge": {
"Arch": "NATHVM64"
},
"m3.2xlarge": {
"Arch": "NATHVM64"
},
"m4.large": {
"Arch": "NATHVM64"
},
"m4.xlarge": {
"Arch": "NATHVM64"
},
"m4.2xlarge": {
"Arch": "NATHVM64"
},
"m4.4xlarge": {
"Arch": "NATHVM64"
},
"m4.10xlarge": {
"Arch": "NATHVM64"
},
"c1.medium": {
"Arch": "NATPV64"
},
"c1.xlarge": {
"Arch": "NATPV64"
},
"c3.large": {
"Arch": "NATHVM64"
},
"c3.xlarge": {
"Arch": "NATHVM64"
},
"c3.2xlarge": {
"Arch": "NATHVM64"
},
"c3.4xlarge": {
"Arch": "NATHVM64"
},
"c3.8xlarge": {
"Arch": "NATHVM64"
},
"c4.large": {
"Arch": "NATHVM64"
},
"c4.xlarge": {
"Arch": "NATHVM64"
},
"c4.2xlarge": {
"Arch": "NATHVM64"
},
"c4.4xlarge": {
"Arch": "NATHVM64"
},
"c4.8xlarge": {
"Arch": "NATHVM64"
},
"g2.2xlarge": {
"Arch": "NATHVMG2"
},
"g2.8xlarge": {
"Arch": "NATHVMG2"
},
"r3.large": {
"Arch": "NATHVM64"
},
"r3.xlarge": {
"Arch": "NATHVM64"
},
"r3.2xlarge": {
"Arch": "NATHVM64"
},
"r3.4xlarge": {
"Arch": "NATHVM64"
},
"r3.8xlarge": {
"Arch": "NATHVM64"
},
"i2.xlarge": {
"Arch": "NATHVM64"
},
"i2.2xlarge": {
"Arch": "NATHVM64"
},
"i2.4xlarge": {
"Arch": "NATHVM64"
},
"i2.8xlarge": {
"Arch": "NATHVM64"
},
"d2.xlarge": {
"Arch": "NATHVM64"
},
"d2.2xlarge": {
"Arch": "NATHVM64"
},
"d2.4xlarge": {
"Arch": "NATHVM64"
},
"d2.8xlarge": {
"Arch": "NATHVM64"
},
"hi1.4xlarge": {
"Arch": "NATHVM64"
},
"hs1.8xlarge": {
"Arch": "NATHVM64"
},
"cr1.8xlarge": {
"Arch": "NATHVM64"
},
"cc2.8xlarge": {
"Arch": "NATHVM64"
}
},
"AWSRegionArch2AMI": {
"us-east-1": {
"PV64": "ami-2a69aa47",
"HVM64": "ami-6869aa05",
"HVMG2": "ami-a41a3fb3"
},
"us-west-2": {
"PV64": "ami-7f77b31f",
"HVM64": "ami-7172b611",
"HVMG2": "ami-caf253aa"
},
"us-west-1": {
"PV64": "ami-a2490dc2",
"HVM64": "ami-31490d51",
"HVMG2": "ami-00347e60"
},
"eu-west-1": {
"PV64": "ami-4cdd453f",
"HVM64": "ami-f9dd458a",
"HVMG2": "ami-e2f7bd91"
},
"eu-west-2": {
"PV64": "NOT_SUPPORTED",
"HVM64": "ami-886369ec",
"HVMG2": "NOT_SUPPORTED"
},
"eu-central-1": {
"PV64": "ami-6527cf0a",
"HVM64": "ami-ea26ce85",
"HVMG2": "ami-d2ff04bd"
},
"ap-northeast-1": {
"PV64": "ami-3e42b65f",
"HVM64": "ami-374db956",
"HVMG2": "ami-4c78d52d"
},
"ap-northeast-2": {
"PV64": "NOT_SUPPORTED",
"HVM64": "ami-2b408b45",
"HVMG2": "NOT_SUPPORTED"
},
"ap-southeast-1": {
"PV64": "ami-df9e4cbc",
"HVM64": "ami-a59b49c6",
"HVMG2": "ami-f3f95990"
},
"ap-southeast-2": {
"PV64": "ami-63351d00",
"HVM64": "ami-dc361ebf",
"HVMG2": "ami-3a122e59"
},
"ap-south-1": {
"PV64": "NOT_SUPPORTED",
"HVM64": "ami-ffbdd790",
"HVMG2": "ami-21a7d34e"
},
"us-east-2": {
"PV64": "NOT_SUPPORTED",
"HVM64": "ami-f6035893",
"HVMG2": "NOT_SUPPORTED"
},
"ca-central-1": {
"PV64": "NOT_SUPPORTED",
"HVM64": "ami-730ebd17",
"HVMG2": "NOT_SUPPORTED"
},
"sa-east-1": {
"PV64": "ami-1ad34676",
"HVM64": "ami-6dd04501",
"HVMG2": "NOT_SUPPORTED"
},
"cn-north-1": {
"PV64": "ami-77559f1a",
"HVM64": "ami-8e6aa0e3",
"HVMG2": "NOT_SUPPORTED"
}
}
},
"myPrivateSubneta": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"VpcId": {
"Ref": "myVPC"
},
"CidrBlock": "10.0.2.0/24",
"AvailabilityZone": "us-east-2a",
"MapPublicIpOnLaunch": "false",
"Tags": [
{
"Key": "Name",
"Value": "PrivateSubnet-a"
}
]
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "392730a7-56a2-4588-b56f-0dbcb9466dcd"
}
},
"DependsOn": [
"myVPC"
]
},
"myPrivateSubnetRouteTableAssociationa": {
"Type": "AWS::EC2::SubnetRouteTableAssociation",
"Properties": {
"SubnetId": {
"Ref": "myPrivateSubneta"
},
"RouteTableId": {
"Ref": "myPrivateRouteTable"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "6ce84c3a-cbfe-41b7-bd3b-5c5b88e56b7e"
}
}
},
"myPrivateSubnetNetworkAclAssociationa": {
"Type": "AWS::EC2::SubnetNetworkAclAssociation",
"Properties": {
"NetworkAclId": {
"Ref": "myPrivateNetworkACL"
},
"SubnetId": {
"Ref": "myPrivateSubneta"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "65c30135-c1eb-4b7b-876b-3de03a341dd9"
}
}
},
"myPrivateSubnetb": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"VpcId": {
"Ref": "myVPC"
},
"CidrBlock": "10.0.3.0/24",
"AvailabilityZone": "us-east-2b",
"MapPublicIpOnLaunch": "false",
"Tags": [
{
"Key": "Name",
"Value": "PrivateSubnet-b"
}
]
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "12700c5e-e62b-42e7-bf2f-49c5c1206a31"
}
},
"DependsOn": [
"myVPC"
]
},
"myPrivateSubnetNetworkAclAssociationb": {
"Type": "AWS::EC2::SubnetNetworkAclAssociation",
"Properties": {
"NetworkAclId": {
"Ref": "myPrivateNetworkACL"
},
"SubnetId": {
"Ref": "myPrivateSubnetb"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "f1351fe5-2417-4c1f-b23b-890821aac2c6"
}
}
},
"myPrivateSubnetRouteTableAssociationb": {
"Type": "AWS::EC2::SubnetRouteTableAssociation",
"Properties": {
"RouteTableId": {
"Ref": "myPrivateRouteTable"
},
"SubnetId": {
"Ref": "myPrivateSubnetb"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "cd058cb1-2395-4810-b3a2-ca324c5cadba"
}
}
},
"myPublicRoute": {
"Type": "AWS::EC2::Route",
"Properties": {
"DestinationCidrBlock": "0.0.0.0/0",
"GatewayId": {
"Ref": "myInternetGateway"
},
"RouteTableId": {
"Ref": "myPublicRouteTable"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "04523216-3b82-44fe-9551-a5f8df1bb934"
}
},
"DependsOn": [
"myPublicRouteTable",
"myInternetGateway"
]
},
"myInternetGateway": {
"Type": "AWS::EC2::InternetGateway",
"Properties": {
"Tags": [
{
"Key": "Name",
"Value": "IG"
}
]
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "e0a679c2-91c5-4c3e-b4a0-dd7ba3be59be"
}
}
},
"myPublicRouteTable": {
"Type": "AWS::EC2::RouteTable",
"Properties": {
"VpcId": {
"Ref": "myVPC"
},
"Tags": [
{
"Key": "Name",
"Value": "PublicRouteTable"
}
]
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "8f76349e-cf36-46de-bf4d-758084864eb8"
}
},
"DependsOn": [
"myVPC"
]
},
"myGatewayAttachment": {
"Type": "AWS::EC2::VPCGatewayAttachment",
"Properties": {
"InternetGatewayId": {
"Ref": "myInternetGateway"
},
"VpcId": {
"Ref": "myVPC"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "29dbc836-febc-4a5b-936d-56f37ab024be"
}
}
},
"myPrivateRouteTable": {
"Type": "AWS::EC2::RouteTable",
"Properties": {
"VpcId": {
"Ref": "myVPC"
},
"Tags": [
{
"Key": "Name",
"Value": "PrivateRouteTable"
}
]
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "8f76349e-cf36-46de-bf4d-758084864eb8"
}
},
"DependsOn": [
"myVPC"
]
},
"myPrivateRoute": {
"Type": "AWS::EC2::Route",
"Properties": {
"DestinationCidrBlock": "0.0.0.0/0",
"NatGatewayId": {
"Ref": "myNatGateway"
},
"RouteTableId": {
"Ref": "myPrivateRouteTable"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "b9fa216c-4718-4ed4-938f-6b62302e7777"
}
},
"DependsOn": [
"myPrivateRouteTable",
"myNatGateway"
]
},
"myNatGateway": {
"Type": "AWS::EC2::NatGateway",
"Properties": {
"AllocationId": {
"Fn::GetAtt": [
"myEIP",
"AllocationId"
]
},
"SubnetId": {
"Ref": "myPublicSubneta"
},
"Tags": [
{
"Key": "Name",
"Value": "myNatGateway"
}
]
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "017e70fc-5c3b-4991-bc68-8fe3b668f199"
}
}
},
"myEIP": {
"Type": "AWS::EC2::EIP",
"Properties": {
"Domain": "myVPC"
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "1c1cf8fa-de79-4654-845e-371e4724e179"
}
}
},
"mySecurityGroupELB": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"VpcId": {
"Ref": "myVPC"
},
"GroupName": "sgELB",
"GroupDescription": "sg-ELB",
"SecurityGroupIngress": [
{
"IpProtocol": "tcp",
"FromPort": "80",
"ToPort": "80",
"CidrIp": "0.0.0.0/0"
},
{
"IpProtocol": "tcp",
"FromPort": "443",
"ToPort": "443",
"CidrIp": "0.0.0.0/0"
}
],
"SecurityGroupEgress": [
{
"IpProtocol": -1,
"CidrIp": "0.0.0.0/0"
}
],
"Tags": [
{
"Key": "Name",
"Value": "SecurityGroupELB"
}
]
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "f0669ab5-0e6a-40af-a9da-f0d244da08f9"
}
}
},
"mySecurityGroupBastion": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"VpcId": {
"Ref": "myVPC"
},
"GroupName": "sgBastionHost",
"GroupDescription": "sg-BastionHost",
"SecurityGroupIngress": [
{
"IpProtocol": "tcp",
"FromPort": "22",
"ToPort": "22",
"CidrIp": "0.0.0.0/0"
}
],
"SecurityGroupEgress": [
{
"IpProtocol": -1,
"CidrIp": "0.0.0.0/0"
}
],
"Tags": [
{
"Key": "Name",
"Value": "SecurityGroupBastion"
}
]
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "f0669ab5-0e6a-40af-a9da-f0d244da08f9"
}
}
},
"mySecurityGroupWeb": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"VpcId": {
"Ref": "myVPC"
},
"GroupName": "sgWeb",
"GroupDescription": "sg-Web",
"SecurityGroupIngress": [
{
"IpProtocol": "tcp",
"FromPort": "80",
"ToPort": "80",
"SourceSecurityGroupId": {
"Ref" : "mySecurityGroupELB"
}
},
{
"IpProtocol": "tcp",
"FromPort": "22",
"ToPort": "22",
"SourceSecurityGroupId": {
"Ref" : "mySecurityGroupBastion"
}
},
{
"IpProtocol": "tcp",
"FromPort": "443",
"ToPort": "443",
"SourceSecurityGroupId": {
"Ref" : "mySecurityGroupELB"
}
}
],
"SecurityGroupEgress": [
{
"IpProtocol": -1,
"CidrIp": "0.0.0.0/0"
}
],
"Tags": [
{
"Key": "Name",
"Value": "SecurityGroupWeb"
}
]
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "f0669ab5-0e6a-40af-a9da-f0d244da08f9"
}
}
},
"myPublicSubneta": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"VpcId": {
"Ref": "myVPC"
},
"CidrBlock": "10.0.0.0/24",
"AvailabilityZone": "us-east-2a",
"MapPublicIpOnLaunch": "true",
"Tags": [
{
"Key": "Name",
"Value": "PublicSubnet-a"
}
]
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "392730a7-56a2-4588-b56f-0dbcb9466dcd"
}
},
"DependsOn": [
"myVPC"
]
},
"mySubnetRouteTableAssociationa": {
"Type": "AWS::EC2::SubnetRouteTableAssociation",
"Properties": {
"SubnetId": {
"Ref": "myPublicSubneta"
},
"RouteTableId": {
"Ref": "myPublicRouteTable"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "6ce84c3a-cbfe-41b7-bd3b-5c5b88e56b7e"
}
}
},
"mySubnetNetworkAclAssociationa": {
"Type": "AWS::EC2::SubnetNetworkAclAssociation",
"Properties": {
"NetworkAclId": {
"Ref": "myNetworkACL"
},
"SubnetId": {
"Ref": "myPublicSubneta"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "65c30135-c1eb-4b7b-876b-3de03a341dd9"
}
}
},
"myPublicSubnetb": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"VpcId": {
"Ref": "myVPC"
},
"CidrBlock": "10.0.1.0/24",
"AvailabilityZone": "us-east-2b",
"MapPublicIpOnLaunch": "true",
"Tags": [
{
"Key": "Name",
"Value": "PublicSubnet-b"
}
]
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "12700c5e-e62b-42e7-bf2f-49c5c1206a31"
}
},
"DependsOn": [
"myVPC"
]
},
"mySubnetNetworkAclAssociationb": {
"Type": "AWS::EC2::SubnetNetworkAclAssociation",
"Properties": {
"NetworkAclId": {
"Ref": "myNetworkACL"
},
"SubnetId": {
"Ref": "myPublicSubnetb"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "f1351fe5-2417-4c1f-b23b-890821aac2c6"
}
}
},
"mySubnetRouteTableAssociationb": {
"Type": "AWS::EC2::SubnetRouteTableAssociation",
"Properties": {
"RouteTableId": {
"Ref": "myPublicRouteTable"
},
"SubnetId": {
"Ref": "myPublicSubnetb"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "cd058cb1-2395-4810-b3a2-ca324c5cadba"
}
}
},
"myVPC": {
"Type": "AWS::EC2::VPC",
"Properties": {
"CidrBlock": "10.0.0.0/16",
"EnableDnsSupport": "true",
"EnableDnsHostnames": "true",
"InstanceTenancy": "default",
"Tags": [
{
"Key": "Name",
"Value": "VPC"
}
]
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "589381ef-c94e-41f4-9f8e-2bdd20f18263"
}
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment