Explicitly specify AZ for boot volume

If a volume is to be used as a boot volume (i.e. attached to the
Instance prior to creation using the Volumes property, rather than
afterwards with a VolumeAttachment), then it cannot obtain the
AvailabilityZone (which, if not specified, is assigned dynamically) from
the Instance, since that has not yet been created and assigned to an AZ.
Instead, require the AZ to be specified as a parameter.

Change-Id: Icccc9b531b1fd7754d76c13d90679ed04c9c0d02
This commit is contained in:
Zane Bitter 2013-05-28 19:01:22 +02:00
parent 92a15bdd92
commit d61d84edbb
1 changed files with 8 additions and 1 deletions

View File

@ -5,6 +5,12 @@
"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"
@ -57,6 +63,7 @@
"Ec2Instance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"AvailabilityZone" : { "Ref" : "AvailabilityZone" },
"SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ],
"ImageId" : { "Fn::FindInMap" : [ "DistroArch2AMI", { "Ref" : "LinuxDistribution" },
{ "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "InstanceType" }, "Arch" ] } ] },
@ -87,7 +94,7 @@
"Type" : "AWS::EC2::Volume",
"Properties" : {
"Size" : { "Ref" : "VolumeSize" },
"AvailabilityZone" : { "Fn::GetAtt" : [ "Ec2Instance", "AvailabilityZone" ]}
"AvailabilityZone" : { "Ref" : "AvailabilityZone" }
}
}
},