@@ -1098,7 +1098,7 @@ def _aws_handler(blocked_resources: Set['resources_lib.Resources'],
1098
1098
output = str (error )
1099
1099
logger .info (f'AWS handler error: { output } ' )
1100
1100
# Block AWS if the credential has expired.
1101
- if output .find ('CloudCredentialExpired ' ) != - 1 :
1101
+ if output .find ('InvalidCloudCredentials ' ) != - 1 :
1102
1102
_add_to_blocked_resources (
1103
1103
blocked_resources , resources_lib .Resources (cloud = clouds .AWS ()))
1104
1104
else :
@@ -1435,6 +1435,17 @@ def _retry_zones(
1435
1435
# does not have nodes labeled with GPU types.
1436
1436
logger .info (f'{ e } ' )
1437
1437
continue
1438
+ except exceptions .InvalidCloudCredentials as e :
1439
+ # Failed due to invalid cloud credentials.
1440
+ logger .warning (f'{ common_utils .format_exception (e )} ' )
1441
+ # We should block the entire cloud for invalid cloud credentials
1442
+ _add_to_blocked_resources (
1443
+ self ._blocked_resources ,
1444
+ to_provision .copy (region = None , zone = None ))
1445
+ raise exceptions .ResourcesUnavailableError (
1446
+ f'Failed to provision on cloud { to_provision .cloud } due to '
1447
+ f'invalid cloud credentials: '
1448
+ f'{ common_utils .format_exception (e )} ' )
1438
1449
except exceptions .InvalidCloudConfigs as e :
1439
1450
# Failed due to invalid user configs in ~/.sky/config.yaml.
1440
1451
logger .warning (f'{ common_utils .format_exception (e )} ' )
0 commit comments