{ "AWSTemplateFormatVersion" : "2010-09-09", "Description" : "This template creates an instance and an EBS Volume.", "Parameters" : { "AvailabilityZone" : { "Description" : "The Availability Zone in which to launch the instance.", "Type" : "String", "Default" : "nova" }, "KeyName" : { "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instance", "Type" : "String" }, "InstanceType" : { "Description" : "WebServer EC2 instance type", "Type" : "String", "Default" : "m1.small", "AllowedValues" : [ "m1.tiny", "m1.small", "m1.medium", "m1.large", "m1.xlarge" ], "ConstraintDescription" : "must be a valid EC2 instance type." }, "VolumeSize" : { "Description" : "WikiDatabase Volume size", "Type" : "Number", "Default" : "1", "MinValue" : "1", "MaxValue" : "1024", "ConstraintDescription" : "must be between 1 and 1024 Gb." }, "LinuxDistribution": { "Default": "F17", "Description" : "Distribution of choice", "Type": "String", "AllowedValues" : [ "F17" ] } }, "Mappings" : { "AWSInstanceType2Arch" : { "m1.tiny" : { "Arch" : "32" }, "m1.small" : { "Arch" : "64" }, "m1.medium" : { "Arch" : "64" }, "m1.large" : { "Arch" : "64" }, "m1.xlarge" : { "Arch" : "64" } }, "DistroArch2AMI": { "F17" : { "32" : "F17-i386-cfntools", "64" : "F17-x86_64-cfntools" } } }, "Resources" : { "Ec2Instance" : { "Type" : "AWS::EC2::Instance", "Properties" : { "AvailabilityZone" : { "Ref" : "AvailabilityZone" }, "SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ], "ImageId" : { "Fn::FindInMap" : [ "DistroArch2AMI", { "Ref" : "LinuxDistribution" }, { "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "InstanceType" }, "Arch" ] } ] }, "InstanceType" : { "Ref" : "InstanceType" }, "KeyName" : { "Ref" : "KeyName" }, "Volumes" : [ { "VolumeId" : { "Ref" : "NewVolume" }, "Device" : "/dev/vdc1" } ] } }, "InstanceSecurityGroup" : { "Type" : "AWS::EC2::SecurityGroup", "Properties" : { "GroupDescription" : "Enable SSH access via port 22", "SecurityGroupIngress" : [ { "IpProtocol" : "tcp", "FromPort" : "22", "ToPort" : "22", "CidrIp" : "0.0.0.0/0" }] } }, "NewVolume" : { "Type" : "AWS::EC2::Volume", "Properties" : { "Size" : { "Ref" : "VolumeSize" }, "AvailabilityZone" : { "Ref" : "AvailabilityZone" } } } }, "Outputs" : { "InstanceId" : { "Description" : "InstanceId of the newly created EC2 instance", "Value" : { "Ref" : "Ec2Instance" } }, "PublicIP" : { "Description" : "Public IP address of the newly created EC2 instance", "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "PublicIp" ] } }, "PublicDNS" : { "Description" : "Public DNSName of the newly created EC2 instance", "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "PublicDnsName" ] } } } }