From 6f8e3b46941c01ed205120b01eb1f3afa7fe51a6 Mon Sep 17 00:00:00 2001 From: Aaron Donovan Date: Wed, 11 Sep 2019 14:27:15 -0400 Subject: [PATCH] enable users to set ec2-endpoint for nonstandard regions --- pkg/cloud/cloud.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/cloud/cloud.go b/pkg/cloud/cloud.go index 155d627274..ba5d53dacb 100644 --- a/pkg/cloud/cloud.go +++ b/pkg/cloud/cloud.go @@ -20,6 +20,7 @@ import ( "context" "errors" "fmt" + "os" "time" "github.com/aws/aws-sdk-go/aws" @@ -224,6 +225,11 @@ func newEC2Cloud(metadata MetadataService, svc *ec2metadata.EC2Metadata) (Cloud, CredentialsChainVerboseErrors: aws.Bool(true), } + endpoint := os.Getenv("AWS_EC2_ENDPOINT") + if endpoint != "" { + awsConfig.Endpoint = aws.String(endpoint) + } + return &cloud{ metadata: metadata, dm: dm.NewDeviceManager(),