Skip to content

Commit 164b642

Browse files
authored
Use buckets in another region (#707)
1 parent 0f27545 commit 164b642

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

pkg/lib/aws/aws.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,20 @@ func New(region string, bucket string, withAccountID bool) (*Client, error) {
6565
DisableSSL: aws.Bool(false),
6666
}))
6767

68+
bucketLocation, err := GetBucketRegion(bucket)
69+
if err != nil {
70+
return nil, err
71+
}
72+
73+
bucketSess := session.Must(session.NewSession(&aws.Config{
74+
Region: aws.String(bucketLocation),
75+
DisableSSL: aws.Bool(false),
76+
}))
77+
6878
awsClient := &Client{
6979
Bucket: bucket,
7080
Region: region,
71-
S3: s3.New(sess),
81+
S3: s3.New(bucketSess),
7282
stsClient: sts.New(sess),
7383
autoscaling: autoscaling.New(sess),
7484
CloudWatchMetrics: cloudwatch.New(sess),

0 commit comments

Comments
 (0)