@@ -1082,16 +1082,31 @@ class S3Store(AbstractStore):
1082
1082
for S3 buckets.
1083
1083
"""
1084
1084
1085
+ _DEFAULT_REGION = 'us-east-1'
1085
1086
_ACCESS_DENIED_MESSAGE = 'Access Denied'
1087
+ _CUSTOM_ENDPOINT_REGIONS = [
1088
+ 'ap-east-1' , 'me-south-1' , 'af-south-1' , 'eu-south-1' , 'eu-south-2' ,
1089
+ 'ap-south-2' , 'ap-southeast-3' , 'ap-southeast-4' , 'me-central-1' ,
1090
+ 'il-central-1'
1091
+ ]
1086
1092
1087
1093
def __init__ (self ,
1088
1094
name : str ,
1089
1095
source : str ,
1090
- region : Optional [str ] = 'us-east-2' ,
1096
+ region : Optional [str ] = _DEFAULT_REGION ,
1091
1097
is_sky_managed : Optional [bool ] = None ,
1092
1098
sync_on_reconstruction : bool = True ):
1093
1099
self .client : 'boto3.client.Client'
1094
1100
self .bucket : 'StorageHandle'
1101
+ # TODO(romilb): This is purely a stopgap fix for
1102
+ # https://github.com/skypilot-org/skypilot/issues/3405
1103
+ # We should eventually make all opt-in regions also work for S3 by
1104
+ # passing the right endpoint flags.
1105
+ if region in self ._CUSTOM_ENDPOINT_REGIONS :
1106
+ logger .warning ('AWS opt-in regions are not supported for S3. '
1107
+ f'Falling back to default region '
1108
+ f'{ self ._DEFAULT_REGION } for bucket { name !r} .' )
1109
+ region = self ._DEFAULT_REGION
1095
1110
super ().__init__ (name , source , region , is_sky_managed ,
1096
1111
sync_on_reconstruction )
1097
1112
@@ -1424,7 +1439,7 @@ def mount_command(self, mount_path: str) -> str:
1424
1439
1425
1440
def _create_s3_bucket (self ,
1426
1441
bucket_name : str ,
1427
- region = 'us-east-2' ) -> StorageHandle :
1442
+ region = _DEFAULT_REGION ) -> StorageHandle :
1428
1443
"""Creates S3 bucket with specific name in specific region
1429
1444
1430
1445
Args:
0 commit comments