aws: Honour the zone variable when creating an instance

Instances were being created in a different AZ to the one specified in
the zone variable. This could lead to situations where the disks and the
instance were in different AZs and would result in an error.

This commit adds placement information to the API call used to create
the instance.

Fixes: #2388

Signed-off-by: Dave Tucker <dt@docker.com>
This commit is contained in:
Dave Tucker 2017-08-10 16:49:56 +01:00
parent d2b7782419
commit f574ada213

View File

@ -88,6 +88,9 @@ func runAWS(args []string) {
InstanceType: aws.String(machine),
MinCount: aws.Int64(1),
MaxCount: aws.Int64(1),
Placement: &ec2.Placement{
AvailabilityZone: aws.String(zone),
},
}
runResult, err := compute.RunInstances(params)
if err != nil {