Created
October 17, 2013 09:32
-
-
Save palfrey/7021931 to your computer and use it in GitHub Desktop.
Broken CloudFormation setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "AWSTemplateFormatVersion" : "2010-09-09", | |
| "Description" : "Test servers", | |
| "Parameters" : { | |
| "Environment" : { | |
| "Type" : "String", | |
| "Default" : "dev", | |
| "Description" : "Environment name", | |
| "MinLength": "2", | |
| "MaxLength": "64", | |
| "AllowedPattern" : "[a-zA-Z][a-zA-Z0-9]*", | |
| "ConstraintDescription" : "Must begin with a letter and contain only alphanumeric characters" | |
| }, | |
| "WebInstanceType" : { | |
| "Type" : "String", | |
| "Default" : "m1.small", | |
| "Description" : "EC2 instance type", | |
| "AllowedValues" : [ "t1.micro","m1.small","m1.medium"], | |
| "ConstraintDescription" : "must be a valid EC2 instance type" | |
| }, | |
| "AmazonMachineImage" : { | |
| "Type" : "String", | |
| "Default" : "ami-a63edbd1", | |
| "Description" : "[Hidden]AMI to launch. Default is a Microsoft Windows Server 2012 image provided by Amazon" | |
| }, | |
| "KeyPair" : { | |
| "Type" : "String", | |
| "Default" : "Foo bar", | |
| "Description" : "[Hidden]EC2 Key Pair." | |
| } | |
| }, | |
| "Resources" : { | |
| "VPC" : { | |
| "Type" : "AWS::EC2::VPC", | |
| "Properties" : { | |
| "CidrBlock" : "10.12.0.0/16", | |
| "EnableDnsSupport" : "true", | |
| "EnableDnsHostnames" : "true", | |
| "Tags" : [ | |
| {"Key" : "Name", "Value" : {"Fn::Join" : ["", ["Test for ", {"Ref" : "Environment"}]]}} | |
| ] | |
| } | |
| }, | |
| "InternetGateway" : { | |
| "Type" : "AWS::EC2::InternetGateway" | |
| }, | |
| "AttachGateway" : { | |
| "Type" : "AWS::EC2::VPCGatewayAttachment", | |
| "Properties" : { | |
| "VpcId" : { "Ref" : "VPC" }, | |
| "InternetGatewayId" : { "Ref" : "InternetGateway" } | |
| } | |
| }, | |
| "FirstSubnet" : { | |
| "Type" : "AWS::EC2::Subnet", | |
| "Properties" : { | |
| "VpcId" : { "Ref" : "VPC" }, | |
| "CidrBlock" : "10.12.0.0/24", | |
| "AvailabilityZone" : "eu-west-1a" | |
| } | |
| }, | |
| "SecondSubnet" : { | |
| "Type" : "AWS::EC2::Subnet", | |
| "Properties" : { | |
| "VpcId" : { "Ref" : "VPC" }, | |
| "CidrBlock" : "10.12.1.0/24", | |
| "AvailabilityZone" : "eu-west-1b" | |
| } | |
| }, | |
| "WebServer" : { | |
| "Type" : "AWS::EC2::Instance", | |
| "Properties" : { | |
| "ImageId" : {"Ref" : "AmazonMachineImage"}, | |
| "InstanceType" : {"Ref" : "WebInstanceType"}, | |
| "KeyName" : {"Ref" : "KeyPair"}, | |
| "SecurityGroupIds" : [{"Ref" : "WebSecurityGroup"}], | |
| "SubnetId" : { "Ref" : "FirstSubnet" }, | |
| "Tags" : [ | |
| { "Key" : "Name", "Value" : {"Fn::Join" : ["", ["Web", {"Ref" : "Environment"}]]} }, | |
| { "Key" : "Environment", "Value" : {"Ref" : "Environment"} } | |
| ] | |
| } | |
| }, | |
| "WebServerEIP": { | |
| "Type" : "AWS::EC2::EIP", | |
| "Properties" : { | |
| "InstanceId" : {"Ref" :"WebServer"}, | |
| "Domain" : "vpc" | |
| } | |
| }, | |
| "WebSecurityGroup": { | |
| "Type": "AWS::EC2::SecurityGroup", | |
| "Properties": { | |
| "GroupDescription": "Web security group", | |
| "VpcId": {"Ref" : "VPC"}, | |
| "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"}, | |
| {"IpProtocol": "tcp", "FromPort": "5985", "ToPort": "5985", "CidrIp": "0.0.0.0/0"}, | |
| {"IpProtocol": "tcp", "FromPort": "3389", "ToPort": "3389", "CidrIp": "0.0.0.0/0"}, | |
| {"IpProtocol": "tcp", "FromPort": "3389", "ToPort": "10933", "CidrIp": "0.0.0.0/0"} | |
| ], | |
| "SecurityGroupEgress": [{"IpProtocol": "-1", "CidrIp": "0.0.0.0/0"}] | |
| } | |
| }, | |
| "RouteTable" : { | |
| "Type" : "AWS::EC2::RouteTable", | |
| "Properties" : { | |
| "VpcId" : { "Ref" : "VPC" } | |
| } | |
| }, | |
| "Route" : { | |
| "Type" : "AWS::EC2::Route", | |
| "Properties" : { | |
| "RouteTableId" : { "Ref" : "RouteTable" }, | |
| "DestinationCidrBlock" : "0.0.0.0/0", | |
| "GatewayId" : { "Ref" : "InternetGateway" } | |
| } | |
| }, | |
| "SubnetRouteTableAssociation" : { | |
| "Type" : "AWS::EC2::SubnetRouteTableAssociation", | |
| "Properties" : { | |
| "SubnetId" : { "Ref" : "FirstSubnet" }, | |
| "RouteTableId" : { "Ref" : "RouteTable" } | |
| } | |
| } | |
| }, | |
| "Outputs" : { | |
| "WebSiteURL" : { | |
| "Description" : "URL of the new Web site", | |
| "Value" : { | |
| "Fn::Join" : ["", ["http://", {"Fn::GetAtt" : ["WebServer", "PublicDnsName"]}]] | |
| } | |
| }, | |
| "WebSitePrivateIp" : { | |
| "Description" : "Private Ip of the new Web site", | |
| "Value" : { | |
| "Fn::GetAtt" : ["WebServer", "PrivateIp"] | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment