Skip to content

Commit 6fb2999

Browse files
authored
Merge pull request #170 from kmala/storage
fix(boto): specify the region while getting s3 connection
2 parents 81ebefa + 388c593 commit 6fb2999

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

rootfs/bin/create_bucket

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import os
44

5-
import boto
5+
import boto.s3
66
import json
77
import swiftclient
88
from boto import config as botoconfig
@@ -19,12 +19,13 @@ def bucket_exists(conn, name):
1919
return True
2020

2121
bucket_name = os.getenv('BUCKET_NAME')
22+
region = os.getenv('AWS_REGION')
2223

2324
if os.getenv('DATABASE_STORAGE') == "s3":
24-
conn = boto.connect_s3()
25+
conn = boto.s3.connect_to_region(region)
2526

2627
if not bucket_exists(conn, bucket_name):
27-
conn.create_bucket(bucket_name)
28+
conn.create_bucket(bucket_name, location=region)
2829

2930
elif os.getenv('DATABASE_STORAGE') == "gcs":
3031
scopes = ['https://www.googleapis.com/auth/devstorage.full_control']

0 commit comments

Comments
 (0)