AWS named profile with Access Key
Named profile
A named profile is a collection of settings and
credentials that you can apply to a AWS CLI command.
Requirement
aws users
aws cli
Creating the User access key
Access to your aws console account and open to iam ( https://console.aws.amazon.com/iam/ )
Choose users
Choose security credential tap
In the Access keys section, choose Create access key.
To download the key pair, choose Download .csv file.
Creating AWS named profile
$ aws configure
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE (Your key id)
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY (Your Secret Key)
Default region name [None]: ap-southeast-1
This will have created the ~/.aws/credentials file and ~/.aws/config populated it with the credentials settings.
$ ls -la ~/.aws/
total 16
drwxr-xr-x 4 xxxxxx staff 128 Feb 14 12:54 .
drwxr-xr-x+ 79xxxxxx staff 2528May 23 16:01 ..
-rw------- 1 xxxxxxx staff 138 Aug 6 2020 config
-rw------- 1 xxxxxxx staff 231 Feb 14 12:54 credentials
Verify
$ cat credentials
[default]
aws_access_key_id=AKIAIOSFODNN7EXAMPLE
aws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
$ aws sts get-caller-identity
{
"UserId": "AKIAIOSFODNN7EXAMPLE",
"Account": "xxxxxxxxxxxx",
"Arn": "arn:aws:iam::xxxxxxxxx:user/xxxxxxxxx"
}
ref: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html
Default output format [None]: json
Comments
Post a Comment