|
| 1 | +{ |
| 2 | + "AWSTemplateFormatVersion": "2010-09-09", |
| 3 | + "Description": "Deis on EC2: http://deis.io/", |
| 4 | + "Mappings" : { |
| 5 | + "RegionMap" : { |
| 6 | + "ap-northeast-1" : { |
| 7 | + "AMI" : "ami-85265f84" |
| 8 | + }, |
| 9 | + "sa-east-1" : { |
| 10 | + "AMI" : "ami-9757f58a" |
| 11 | + }, |
| 12 | + "ap-southeast-2" : { |
| 13 | + "AMI" : "ami-815fc7bb" |
| 14 | + }, |
| 15 | + "ap-southeast-1" : { |
| 16 | + "AMI" : "ami-b80350ea" |
| 17 | + }, |
| 18 | + "us-east-1" : { |
| 19 | + "AMI" : "ami-97617dfe" |
| 20 | + }, |
| 21 | + "us-west-2" : { |
| 22 | + "AMI" : "ami-0ccfa43c" |
| 23 | + }, |
| 24 | + "us-west-1" : { |
| 25 | + "AMI" : "ami-f8d3eabd" |
| 26 | + }, |
| 27 | + "eu-west-1" : { |
| 28 | + "AMI" : "ami-dbdc27ac" |
| 29 | + } |
| 30 | + } |
| 31 | + }, |
| 32 | + "Parameters": { |
| 33 | + "InstanceType" : { |
| 34 | + "Description" : "EC2 instance type (m1.small, etc).", |
| 35 | + "Type" : "String", |
| 36 | + "Default" : "t1.micro", |
| 37 | + "AllowedValues" : [ "t1.micro","m1.small","m1.medium","m1.large","m1.xlarge", "m3.xlarge", "m3.2xlarge", "m2.xlarge","m2.2xlarge","m2.4xlarge","c1.medium","c1.xlarge","cc1.4xlarge","cc2.8xlarge","cg1.4xlarge", "hi1.4xlarge", "hs1.8xlarge"], |
| 38 | + "ConstraintDescription" : "must be a valid EC2 instance type." |
| 39 | + }, |
| 40 | + "ClusterSize": { |
| 41 | + "Default": "3", |
| 42 | + "MinValue": "3", |
| 43 | + "MaxValue": "12", |
| 44 | + "Description": "Number of nodes in cluster (3-12).", |
| 45 | + "Type": "Number" |
| 46 | + }, |
| 47 | + "DiscoveryURL": { |
| 48 | + "Description": "An unique etcd cluster discovery URL. Grab a new token from https://discovery.etcd.io/new", |
| 49 | + "Type": "String" |
| 50 | + }, |
| 51 | + "AdvertisedIPAddress": { |
| 52 | + "Description": "Use 'private' if your etcd cluster is within one region or 'public' if it spans regions or cloud providers.", |
| 53 | + "Default": "private", |
| 54 | + "AllowedValues": ["private", "public"], |
| 55 | + "Type": "String" |
| 56 | + }, |
| 57 | + "AllowSSHFrom": { |
| 58 | + "Description": "The net block (CIDR) that SSH is available to.", |
| 59 | + "Default": "0.0.0.0/0", |
| 60 | + "Type": "String" |
| 61 | + }, |
| 62 | + "KeyPair" : { |
| 63 | + "Description" : "The name of an EC2 Key Pair to allow SSH access to the instance.", |
| 64 | + "Type" : "String" |
| 65 | + } |
| 66 | + }, |
| 67 | + "Resources": { |
| 68 | + "CoreOSSecurityGroup": { |
| 69 | + "Type": "AWS::EC2::SecurityGroup", |
| 70 | + "Properties": { |
| 71 | + "GroupDescription": "CoreOS SecurityGroup", |
| 72 | + "SecurityGroupIngress": [ |
| 73 | + {"IpProtocol": "tcp", "FromPort": "22", "ToPort": "22", "CidrIp": {"Ref": "AllowSSHFrom"}} |
| 74 | + ] |
| 75 | + } |
| 76 | + }, |
| 77 | + "DeisSecurityGroup": { |
| 78 | + "Type": "AWS::EC2::SecurityGroup", |
| 79 | + "Properties": { |
| 80 | + "GroupDescription": "Deis SecurityGroup", |
| 81 | + "SecurityGroupIngress": [ |
| 82 | + {"IpProtocol": "tcp", "FromPort": "80", "ToPort": "80", "CidrIp": "0.0.0.0/0"}, |
| 83 | + {"IpProtocol": "tcp", "FromPort": "514", "ToPort": "514", "CidrIp": "0.0.0.0/0"}, |
| 84 | + {"IpProtocol": "tcp", "FromPort": "2222", "ToPort": "2222", "CidrIp": "0.0.0.0/0"}, |
| 85 | + {"IpProtocol": "tcp", "FromPort": "5000", "ToPort": "5000", "CidrIp": "0.0.0.0/0"}, |
| 86 | + {"IpProtocol": "tcp", "FromPort": "5432", "ToPort": "5432", "CidrIp": "0.0.0.0/0"}, |
| 87 | + {"IpProtocol": "tcp", "FromPort": "6379", "ToPort": "6379", "CidrIp": "0.0.0.0/0"}, |
| 88 | + {"IpProtocol": "tcp", "FromPort": "8000", "ToPort": "8000", "CidrIp": "0.0.0.0/0"}, |
| 89 | + {"IpProtocol": "tcp", "FromPort": "49156", "ToPort": "65535", "CidrIp": "0.0.0.0/0"} |
| 90 | + ] |
| 91 | + } |
| 92 | + }, |
| 93 | + "Ingress4001": { |
| 94 | + "Type": "AWS::EC2::SecurityGroupIngress", |
| 95 | + "Properties": { |
| 96 | + "GroupName": {"Ref": "CoreOSSecurityGroup"}, "IpProtocol": "tcp", "FromPort": "4001", "ToPort": "4001", "SourceSecurityGroupId": { |
| 97 | + "Fn::GetAtt" : [ "CoreOSSecurityGroup", "GroupId" ] |
| 98 | + } |
| 99 | + } |
| 100 | + }, |
| 101 | + "Ingress7001": { |
| 102 | + "Type": "AWS::EC2::SecurityGroupIngress", |
| 103 | + "Properties": { |
| 104 | + "GroupName": {"Ref": "CoreOSSecurityGroup"}, "IpProtocol": "tcp", "FromPort": "7001", "ToPort": "7001", "SourceSecurityGroupId": { |
| 105 | + "Fn::GetAtt" : [ "CoreOSSecurityGroup", "GroupId" ] |
| 106 | + } |
| 107 | + } |
| 108 | + }, |
| 109 | + "CoreOSServerAutoScale": { |
| 110 | + "Type": "AWS::AutoScaling::AutoScalingGroup", |
| 111 | + "Properties": { |
| 112 | + "AvailabilityZones": {"Fn::GetAZs": ""}, |
| 113 | + "LaunchConfigurationName": {"Ref": "CoreOSServerLaunchConfig"}, |
| 114 | + "MinSize": "3", |
| 115 | + "MaxSize": "12", |
| 116 | + "DesiredCapacity": {"Ref": "ClusterSize"}, |
| 117 | + "Tags": [ |
| 118 | + {"Key": "Name", "Value": { "Ref" : "AWS::StackName" }, "PropagateAtLaunch": true} |
| 119 | + ] |
| 120 | + } |
| 121 | + }, |
| 122 | + "CoreOSServerLaunchConfig": { |
| 123 | + "Type": "AWS::AutoScaling::LaunchConfiguration", |
| 124 | + "Properties": { |
| 125 | + "ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]}, |
| 126 | + "InstanceType": {"Ref": "InstanceType"}, |
| 127 | + "KeyName": {"Ref": "KeyPair"}, |
| 128 | + "SecurityGroups": [{"Ref": "CoreOSSecurityGroup"}, {"Ref": "DeisSecurityGroup"}], |
| 129 | + "UserData" : { "Fn::Base64": |
| 130 | + { "Fn::Join": [ "", [ |
| 131 | + "#cloud-config\n\n", |
| 132 | + "coreos:\n", |
| 133 | + " etcd:\n", |
| 134 | + " discovery: ", { "Ref": "DiscoveryURL" }, "\n", |
| 135 | + " addr: $", { "Ref": "AdvertisedIPAddress" }, "_ipv4:4001\n", |
| 136 | + " peer-addr: $", { "Ref": "AdvertisedIPAddress" }, "_ipv4:7001\n", |
| 137 | + " units:\n", |
| 138 | + " - name: etcd.service\n", |
| 139 | + " command: start\n", |
| 140 | + " - name: fleet.service\n", |
| 141 | + " command: start\n" |
| 142 | + ] ] |
| 143 | + } |
| 144 | + } |
| 145 | + } |
| 146 | + } |
| 147 | + } |
| 148 | +} |
0 commit comments