Skip to content

Commit 8a6b784

Browse files
author
Dan
authored
fix: use sts regional endpoint when creating default bucket (#1086)
1 parent a98f488 commit 8a6b784

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/sagemaker/session.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,10 @@ def default_bucket(self):
208208
if self._default_bucket:
209209
return self._default_bucket
210210

211-
account = self.boto_session.client("sts").get_caller_identity()["Account"]
212211
region = self.boto_session.region_name
212+
account = self.boto_session.client(
213+
"sts", region_name=region, endpoint_url=sts_regional_endpoint(region)
214+
).get_caller_identity()["Account"]
213215
default_bucket = "sagemaker-{}-{}".format(region, account)
214216

215217
s3 = self.boto_session.resource("s3")
@@ -1400,7 +1402,9 @@ def get_caller_identity_arn(self):
14001402
)
14011403

14021404
assumed_role = self.boto_session.client(
1403-
"sts", endpoint_url=sts_regional_endpoint(self.boto_region_name)
1405+
"sts",
1406+
region_name=self.boto_region_name,
1407+
endpoint_url=sts_regional_endpoint(self.boto_region_name),
14041408
).get_caller_identity()["Arn"]
14051409

14061410
if "AmazonSageMaker-ExecutionRole" in assumed_role:

0 commit comments

Comments
 (0)