Skip to content

Instantly share code, notes, and snippets.

@muhqu
Last active August 29, 2015 14:17
Show Gist options
  • Save muhqu/5ba2de0bc5878a15eaa7 to your computer and use it in GitHub Desktop.
Save muhqu/5ba2de0bc5878a15eaa7 to your computer and use it in GitHub Desktop.
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "",
"Parameters" : {
"InstanceType" : {
"Description" : "",
"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", "hi1.4xlarge", "hs1.8xlarge", "cr1.8xlarge", "cc2.8xlarge", "cg1.4xlarge"],
"ConstraintDescription" : "must be a valid EC2 instance type."
}
},
"Mappings" : {
"AWSInstanceType2Arch" : {
"t1.micro" : { "Arch" : "PV64" },
"t2.micro" : { "Arch" : "HVM64" },
"t2.small" : { "Arch" : "HVM64" },
"t2.medium" : { "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" },
"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" },
"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" },
"hi1.4xlarge" : { "Arch" : "HVM64" },
"hs1.8xlarge" : { "Arch" : "HVM64" },
"cr1.8xlarge" : { "Arch" : "HVM64" },
"cc2.8xlarge" : { "Arch" : "HVM64" }
},
"AWSRegionArch2AMI" : {
"us-east-1" : {"PV64" : "ami-14d18a7c", "HVM64" : "ami-16d18a7e", "HVMG2" : "ami-7200461a"},
"us-west-2" : {"PV64" : "ami-0fe7c43f", "HVM64" : "ami-73e7c443", "HVMG2" : "ami-0b78203b"},
"us-west-1" : {"PV64" : "ami-d342a697", "HVM64" : "ami-f342a6b7", "HVMG2" : "ami-244b5361"},
"eu-west-1" : {"PV64" : "ami-039e0d74", "HVM64" : "ami-ff9e0d88", "HVMG2" : "ami-4d7cf03a"},
"eu-central-1" : {"PV64" : "ami-34ab9929", "HVM64" : "ami-2eab9933", "HVMG2" : "NOT_SUPPORTED"},
"ap-northeast-1" : {"PV64" : "ami-17df3617", "HVM64" : "ami-51df3651", "HVMG2" : "ami-2e90892f"},
"ap-southeast-1" : {"PV64" : "ami-4e596f1c", "HVM64" : "ami-76596f24", "HVMG2" : "ami-3e78526c"},
"ap-southeast-2" : {"PV64" : "ami-a3b8c999", "HVM64" : "ami-99b8c9a3", "HVMG2" : "ami-315e2a0b"},
"sa-east-1" : {"PV64" : "ami-f94af3e4", "HVM64" : "ami-ef4af3f2", "HVMG2" : "NOT_SUPPORTED"},
"cn-north-1" : {"PV64" : "ami-c036a4f9", "HVM64" : "ami-c636a4ff", "HVMG2" : "NOT_SUPPORTED"}
}
},
"Resources" : {
"DummyResource" : {
"Type" : "AWS::CloudFormation::WaitConditionHandle"
}
},
"Outputs" : {
"AMI" : {
"Value" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" },
{ "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "InstanceType" }, "Arch" ] } ] }
}
}
}
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "",
"Parameters" : {
"InstanceType" : {
"Description" : "",
"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", "hi1.4xlarge", "hs1.8xlarge", "cr1.8xlarge", "cc2.8xlarge", "cg1.4xlarge"],
"ConstraintDescription" : "must be a valid EC2 instance type."
}
},
"Resources" : {
"GetAMI" : {
"Type" : "AWS::CloudFormation::Stack",
"Metadata" : {
"Comment" : "Get latest Amazon Linux AMI from separat CFN stack."
},
"Properties" : {
"TemplateURL" : "https://gist.githubusercontent.com/muhqu/5ba2de0bc5878a15eaa7/raw/cfn-amazon-linux-ami-template.json",
"Parameters" : {
"InstanceType" : { "Ref" : "InstanceType"}
}
}
}
},
"Outputs" : {
"AMI" : {
"Value" : { "Fn::GetAtt" : [ "GetAMI", "Outputs.AMI" ] }
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment