diff --git a/agent/s3/factory/factory.go b/agent/s3/factory/factory.go index ec1531c2f9c..a62f03ff71f 100644 --- a/agent/s3/factory/factory.go +++ b/agent/s3/factory/factory.go @@ -28,7 +28,8 @@ import ( ) const ( - roundtripTimeout = 5 * time.Second + bucketLocationDefault = "us-east-1" + roundtripTimeout = 5 * time.Second ) type S3ClientCreator interface { @@ -69,6 +70,9 @@ func getRegionFromBucket(svc *s3.S3, bucket string) (string, error) { if err != nil { return "", err } + if result.LocationConstraint == nil { // GetBucketLocation returns nil for bucket in us-east-1. + return bucketLocationDefault, nil + } return aws.StringValue(result.LocationConstraint), nil }