image.png

  • 1 and 2 are to add environment variables

  • 3 is directly from the credentials file to add the relevant configuration

  • 4 through the aws configure configuration will be gradually added to the credentials file, the profile-name is default, meaning that if you do not indicate the profile, it will go to the default configuration, if you want to specify the profile name of the file you want to use in 3, you can use the following commands

aws ecr get-login-password --region us-east-1 --profile ********_PowerUserPlusRole | docker login --username AWS  --password-stdin *********.dkr.ecr.us-east-1.amazonaws.com

All of the above is to add a temporary token, if you want to realize the automatic acquisition, you can implement the command 1, it will add the relevant settings in the config file, you also need to specify the corresponding profile, do not specify will go to the default

[default]
region = your-region
[profile PowerUserPlusRole-*********]
sso_start_url = sso_start_url_in_command_1
sso_region = sso_region_command_1
sso_account_id = *********
sso_role_name = PowerUserPlusRole
region = your-region
aws ecr get-login-password --region us-east-1 --profile ********_PowerUserPlusRole | docker login --username AWS  --password-stdin *********.dkr.ecr.us-east-1.amazonaws.com

Note: The configuration in configure will be used first, if not, the settings in credentials will be used.

Supplemental:

Login aws

aws sso login --profile PowerUserPlusRole-**********
Last updated: 2024-03-15 14:16:37AWS
Author:Chaolocation:https://www.baidu.com/article/18
Comments
Submit
Be the first one to write a comment ~