From f7f103f723e35397c9a97415e0c96908e82cca69 Mon Sep 17 00:00:00 2001 From: Daniel Kang Date: Sat, 2 Sep 2017 10:09:22 -0700 Subject: [PATCH] fix AMI tag issue --- .travis.yml | 2 +- VERSION | 2 +- commands/clustercreate/aws.go | 18 ++++++++++++++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6eaac91..df00754 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: go go: - - 1.7.3 + - 1.9 before_install: - pip install --user awscli diff --git a/VERSION b/VERSION index 13175fd..c9929e3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.4.1 \ No newline at end of file +1.4.2 \ No newline at end of file diff --git a/commands/clustercreate/aws.go b/commands/clustercreate/aws.go index 9da5ea6..7e4e2ca 100644 --- a/commands/clustercreate/aws.go +++ b/commands/clustercreate/aws.go @@ -3,7 +3,6 @@ package clustercreate import ( "encoding/base64" "fmt" - "strings" "time" "github.com/aws/aws-sdk-go/service/ec2" @@ -18,6 +17,18 @@ const ( defaultECSContainerInstanceImageOwnerID = "865092420289" ) +var defaultImageID = map[string]string{ + aws.AWSRegionAPNorthEast1: "ami-3217ed54", + aws.AWSRegionAPSouthEast1: "ami-b30b67d0", + aws.AWSRegionAPSouthEast2: "ami-5f38dd3d", + aws.AWSRegionEUCentral1: "ami-3645f059", + aws.AWSRegionEUWest1: "ami-d104c1a8", + aws.AWSRegionUSEast1: "ami-c25a4eb9", + aws.AWSRegionUSEast2: "ami-498dae2c", + aws.AWSRegionUSWest1: "ami-fdcefa9d", + aws.AWSRegionUSWest2: "ami-1d28dd65", +} + var defaultECSContainerInstanceAmazonImageID = map[string]string{ aws.AWSRegionUSEast1: "ami-1924770e", aws.AWSRegionUSEast2: "ami-bd3e64d8", @@ -49,7 +60,7 @@ func (c *Command) getAWSInfo() (string, string, []string, error) { } func (c *Command) retrieveDefaultECSContainerInstancesImageID(region string) string { - defaultImages, err := c.awsClient.EC2().FindImage(defaultECSContainerInstanceImageOwnerID, core.AWSTagNameCreatedTimestamp) + /*defaultImages, err := c.awsClient.EC2().FindImage(defaultECSContainerInstanceImageOwnerID, core.AWSTagNameCreatedTimestamp) if err == nil { var latestImage *ec2.Image var latestImageCreationTime string @@ -76,6 +87,9 @@ func (c *Command) retrieveDefaultECSContainerInstancesImageID(region string) str if latestImage != nil { return conv.S(latestImage.ImageId) } + }*/ + if imageID, ok := defaultImageID[region]; ok { + return imageID } // if failed to find coldbrew-cli default image, use Amazon ECS optimized image as fallback