{ "AWSTemplateFormatVersion": "2010-09-09", "Description": "CoreOS on EC2: http://coreos.com/docs/running-coreos/cloud-providers/ec2/", "Mappings" : { "RegionMap" : { "eu-central-1" : { "AMI" : "ami-ffafb293" }, "ap-northeast-1" : { "AMI" : "ami-dae8c1b4" }, "us-gov-west-1" : { "AMI" : "ami-a98e33c8" }, "sa-east-1" : { "AMI" : "ami-4e981c22" }, "ap-southeast-2" : { "AMI" : "ami-eeadf58d" }, "ap-southeast-1" : { "AMI" : "ami-085a9a6b" }, "us-east-1" : { "AMI" : "ami-cbfdb2a1" }, "us-west-2" : { "AMI" : "ami-16cfd277" }, "us-west-1" : { "AMI" : "ami-0eacc46e" }, "eu-west-1" : { "AMI" : "ami-c26bcab1" } } }, "Parameters": { "InstanceType" : { "Description" : "EC2 HVM instance type (m3.medium, etc).", "Type" : "String", "Default" : "t2.medium", "AllowedValues" : [ "t2.micro", "m3.medium", "m3.large", "m3.xlarge", "m3.2xlarge", "c3.large","c3.xlarge", "c3.2xlarge", "c3.4xlarge","c3.8xlarge", "cc2.8xlarge","cr1.8xlarge","hi1.4xlarge", "hs1.8xlarge", "i2.xlarge", "i2.2xlarge", "i2.4xlarge", "i2.8xlarge", "r3.large", "r3.xlarge", "r3.2xlarge","r3.4xlarge", "r3.8xlarge", "t2.micro", "t2.small", "t2.medium" ], "ConstraintDescription" : "Must be a valid EC2 HVM instance type." }, "SecurityGroupId":{ "Type": "List", "Description": "Security group to launch instances into." }, "SubnetId":{ "Type": "List", "Description": "VPC group to launch instances into." }, "ClusterSize": { "Default": "3", "MinValue": "3", "MaxValue": "12", "Description": "Number of nodes in cluster (3-12).", "Type": "Number" }, "DiscoveryURL": { "Description": "An unique etcd cluster discovery URL. Grab a new token from https://discovery.etcd.io/new?size=", "Type": "String" }, "AdvertisedIPAddress": { "Description": "Use 'private' if your etcd cluster is within one region or 'public' if it spans regions or cloud providers.", "Default": "private", "AllowedValues": ["private", "public"], "Type": "String" }, "KeyPair" : { "Description" : "The name of an EC2 Key Pair to allow SSH access to the instance.", "Type" : "AWS::EC2::KeyPair::KeyName" } }, "Resources": { "CoreOSServerAutoScale": { "Type": "AWS::AutoScaling::AutoScalingGroup", "Properties": { "LaunchConfigurationName": {"Ref": "CoreOSServerLaunchConfig"}, "VPCZoneIdentifier": {"Ref":"SubnetId"}, "MinSize": "3", "MaxSize": "12", "DesiredCapacity": {"Ref": "ClusterSize"}, "Tags": [ {"Key": "Name", "Value": { "Ref" : "AWS::StackName" }, "PropagateAtLaunch": true} ] } }, "CoreOSServerLaunchConfig": { "Type": "AWS::AutoScaling::LaunchConfiguration", "Properties": { "ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]}, "InstanceType": {"Ref": "InstanceType"}, "KeyName": {"Ref": "KeyPair"}, "SecurityGroups": {"Ref": "SecurityGroupId"}, "UserData" : { "Fn::Base64": { "Fn::Join": [ "", [ "#cloud-config\n\n", "coreos:\n", " etcd2:\n", " discovery: ", { "Ref": "DiscoveryURL" }, "\n", " advertise-client-urls: http://$", { "Ref": "AdvertisedIPAddress" }, "_ipv4:2379\n", " initial-advertise-peer-urls: http://$", { "Ref": "AdvertisedIPAddress" }, "_ipv4:2380\n", " listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001\n", " listen-peer-urls: http://$", { "Ref": "AdvertisedIPAddress" }, "_ipv4:2380\n", " units:\n", " - name: etcd2.service\n", " command: start\n", " - name: fleet.service\n", " command: start\n" ] ] } } } } } }