From f574ada213b5387050f6dabe7e4b3092eaff7655 Mon Sep 17 00:00:00 2001
From: Dave Tucker
Date: Thu, 10 Aug 2017 16:49:56 +0100
Subject: [PATCH] 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
---
src/cmd/linuxkit/run_aws.go | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/cmd/linuxkit/run_aws.go b/src/cmd/linuxkit/run_aws.go
index aadab66d2..07204c933 100644
--- a/src/cmd/linuxkit/run_aws.go
+++ b/src/cmd/linuxkit/run_aws.go
@@ -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 {