Skip to content

Commit

Permalink
[AWS] Adding custom process as an option for aws credentials (#4547)
Browse files Browse the repository at this point in the history
* Adding custom process as an option for aws credentials

* formatting fixes

---------

Co-authored-by: Clay Rosenthal <[email protected]>
  • Loading branch information
clayrosenthal and clayrosenthal authored Jan 9, 2025
1 parent 9b1ec55 commit 544c34e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion sky/clouds/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ class AWSIdentityType(enum.Enum):

CONTAINER_ROLE = 'container-role'

CUSTOM_PROCESS = 'custom-process'

# Name Value Type Location
# ---- ----- ---- --------
# profile <not set> None None
Expand Down Expand Up @@ -614,10 +616,16 @@ def check_credentials(cls) -> Tuple[bool, Optional[str]]:
hints = f'AWS IAM role is set.{single_cloud_hint}'
elif identity_type == AWSIdentityType.CONTAINER_ROLE:
# Similar to the IAM ROLE, an ECS container may not store credentials
# in the~/.aws/credentials file. So we don't check for the existence of
# in the ~/.aws/credentials file. So we don't check for the existence of
# the file. i.e. the container will be assigned the IAM role of the
# task: skypilot-v1.
hints = f'AWS container-role is set.{single_cloud_hint}'
elif identity_type == AWSIdentityType.CUSTOM_PROCESS:
# Similar to the IAM ROLE, a custom process may not store credentials
# in the ~/.aws/credentials file. So we don't check for the existence of
# the file. i.e. the custom process will be assigned the IAM role of the
# task: skypilot-v1.
hints = f'AWS custom-process is set.{single_cloud_hint}'
else:
# This file is required because it is required by the VMs launched on
# other clouds to access private s3 buckets and resources like EC2.
Expand Down Expand Up @@ -677,6 +685,8 @@ def _is_access_key_of_type(type_str: str) -> bool:
return AWSIdentityType.CONTAINER_ROLE
elif _is_access_key_of_type(AWSIdentityType.ENV.value):
return AWSIdentityType.ENV
elif _is_access_key_of_type(AWSIdentityType.CUSTOM_PROCESS.value):
return AWSIdentityType.CUSTOM_PROCESS
else:
return AWSIdentityType.SHARED_CREDENTIALS_FILE

Expand Down

0 comments on commit 544c34e

Please sign in to comment.