Skip to content

Commit

Permalink
fix: use sts regional endpoint when creating default bucket (#1086)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan committed Oct 12, 2019
1 parent a98f488 commit 8a6b784
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/sagemaker/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,10 @@ def default_bucket(self):
if self._default_bucket:
return self._default_bucket

account = self.boto_session.client("sts").get_caller_identity()["Account"]
region = self.boto_session.region_name
account = self.boto_session.client(
"sts", region_name=region, endpoint_url=sts_regional_endpoint(region)
).get_caller_identity()["Account"]
default_bucket = "sagemaker-{}-{}".format(region, account)

s3 = self.boto_session.resource("s3")
Expand Down Expand Up @@ -1400,7 +1402,9 @@ def get_caller_identity_arn(self):
)

assumed_role = self.boto_session.client(
"sts", endpoint_url=sts_regional_endpoint(self.boto_region_name)
"sts",
region_name=self.boto_region_name,
endpoint_url=sts_regional_endpoint(self.boto_region_name),
).get_caller_identity()["Arn"]

if "AmazonSageMaker-ExecutionRole" in assumed_role:
Expand Down

0 comments on commit 8a6b784

Please sign in to comment.