Created
November 11, 2015 06:44
-
-
Save jordanfarrer/715ca1eb1294c510e724 to your computer and use it in GitHub Desktop.
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" : "AWS CloudFormation AMI Look Up Sample Template: Demonstrates how to dynamically specify an AMI ID. This template provisions an EC2 instance with an AMI ID that is based on the instance's type and region. **WARNING** This template creates an Amazon EC2 instance. You will be billed for the AWS resources used if you create a stack from this template.", | |
"Parameters": { | |
"InstanceType" : { | |
"Description" : "EC2 instance type", | |
"Type" : "String", | |
"Default" : "t2.micro", | |
"AllowedValues" : ["t2.micro"], | |
"ConstraintDescription" : "Must be a valid EC2 instance type." | |
} | |
}, | |
"Mappings" : { | |
"AWSInstanceType2Arch" : { | |
"t2.micro" : { "Arch" : "HVM64" } | |
} | |
}, | |
"Resources" : { | |
"EC2Instance": { | |
"Type": "AWS::EC2::Instance", | |
"Properties": { | |
"InstanceType" : { "Ref" : "InstanceType" }, | |
"ImageId": { "Fn::GetAtt": [ "AMIInfo", "Id" ] } | |
} | |
}, | |
"AMIInfo": { | |
"Type": "AWS::CloudFormation::CustomResource", | |
"Properties": { | |
"ServiceToken": "", | |
"Region": { "Ref": "AWS::Region" }, | |
"Architecture": { "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "InstanceType" }, "Arch" ] } | |
} | |
} | |
}, | |
"Outputs" : { | |
"AMIID" : { | |
"Description": "The Amazon EC2 instance AMI ID.", | |
"Value" : { "Fn::GetAtt": [ "AMIInfo", "Id" ] } | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment