docker-serverless icon indicating copy to clipboard operation
docker-serverless copied to clipboard

Feature request: support aws cli version 2

Open wppaul opened this issue 2 years ago • 1 comments

Describe the feature Currently, amaysim/serverless only support aws cli v1, it would be great to have aws cli v1 supported.

The AWS CLI v2 offers several new features including improved installers, new configuration options such as AWS Single Sign-On (SSO), and various interactive features. More importantly, with https://github.com/serverless/serverless/issues/9290, serverless framework still does not support use the ec2 role, so we have to use assume role scripts to make use of underlying ec2 profile inside serverless container, e.g.

role_arn='arn:aws:iam::account_id:role/ec2-role' 
role_session_name='ec2-test'
profile_name='ec2-test'

temp_role=$(aws sts assume-role \
     --role-arn $role_arn \
     --role-session-name $role_session_name)

export AWS_ACCESS_KEY_ID=$(echo $temp_role | jq -r .Credentials.AccessKeyId)
export AWS_SECRET_ACCESS_KEY=$(echo $temp_role | jq -r .Credentials.SecretAccessKey)
export AWS_SESSION_TOKEN=$(echo $temp_role | jq -r .Credentials.SessionToken)

The above scripts can be replaced by https://awscli.amazonaws.com/v2/documentation/api/latest/reference/configure/export-credentials.html with AWS cli version 2.

Additional context Install aws cli v2 may need some effort to in Alpine as per https://github.com/aws/aws-cli/issues/4685, it is possible as per https://docs.aws.amazon.com/cli/latest/userguide/getting-started-source-install.html - Alpine Linux container

wppaul avatar Apr 27 '23 23:04 wppaul

Thank you @wppaul for opening this issue. Further analysis will be required to understand the impact of removing v1 for us.

flemay avatar May 30 '23 00:05 flemay