diff --git a/builder/amazon/common/access_config.go b/builder/amazon/common/access_config.go index 7dc19f0f1..af5fce6bc 100644 --- a/builder/amazon/common/access_config.go +++ b/builder/amazon/common/access_config.go @@ -63,8 +63,9 @@ func (c *AccessConfig) Session() (*session.Session, error) { config := aws.NewConfig().WithRegion(region).WithMaxRetries(11).WithCredentialsChainVerboseErrors(true) if c.CustomEndpointEc2 != "" { - config.Endpoint = &c.CustomEndpointEc2 + config = config.WithEndpoint(aws.String(c.CustomEndpointEc2)) } + if c.AccessKey != "" { creds := credentials.NewChainCredentials( []credentials.Provider{