Installing AWS CLI via pip3 and python3 - rajivkanaujia/alphaworks GitHub Wiki
Prerequisite
- Install Python3 and Pip3
- Review http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html
- Learn about AWS Access Key ID
Install AWS CLI via pip3
$ pip3 install --user --upgrade awscli
Make changes to path and adjust for correct bin directory for Python3
export PATH=~/.local/bin:~/Library/Python/3.6/bin:$PATH
Configure the AWS keys
The Key ID and Key are sample here
$ aws configure
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: us-east-1
Default output format [None]: json
Check for these at ".aws" folder under your user home
$ cd .aws
$ ls
config credentials
$ cat config
[default]
region = us-east-1
output = json
$ cat credentials
[default]
aws_access_key_id = AKIAIOSFODNN7EXAMPLE
aws_secret_access_key = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Note: The default profile should be for lower environment or with least privilege to avoid accidents.
Create another AWS CLI user profile that uses another keys
$ aws configure --profile user2
Switching between user
$ aws ec2 describe-instances
$ aws ec2 describe-instances --profile user2
List of configured profiles
$ cat ~/.aws/credentials | grep "\["
Test
$ aws s3api list-buckets --profile user2
Note: If you like the instructions here, please refer it on your posts/documentation. Contact me if there are corrections needed.