The SDK is not constructed with the default region when environment variables are set for the region, i.e AWS_REGION and AWS_DEFAULT_REGION. Only by querying the EC2 metadata is it set correctly.
I believe the else block is missing to use the environment variables to source the AWS region for constructing the SDK.
|
if os.Getenv("AWS_REGION") == "" && os.Getenv("AWS_DEFAULT_REGION") == "" { |