Skip to content

Instantly share code, notes, and snippets.

@tusharf5
Created January 24, 2019 07:48
Show Gist options
  • Save tusharf5/1aa4b37d8fb956508c44aaeba3881613 to your computer and use it in GitHub Desktop.
Save tusharf5/1aa4b37d8fb956508c44aaeba3881613 to your computer and use it in GitHub Desktop.
Multiple AWS Profiles on macOS
sudo pip install awscli # Installing aws cli
$ aws configure # Setup
$ aws s3 ls # You can see list of buckets

See credentials file for aws with cat ~/.aws/credentials

This is default profile

[default]
aws_access_key_id = XXXXXX
aws_secret_access_key = YYYYYYY

Create a new profile with aws configure --profile test

Now See credentials file for aws with cat ~/.aws/credentials

[default]
aws_access_key_id = XXXXXX
aws_secret_access_key = YYYYYYY
[test]
aws_access_key_id = XXXXXX
aws_secret_access_key = YYYYYYY

Now

aws s3 ls # You can see s3 buckets of default user
aws s3 ls --profile test # You can see s3 buckets of test user

Manually set default profile for mac export AWS_DEFAULT_PROFILE=test

Manage region and output for profiles ~/.aws/config

[default]
region=us-west-2
output=json

[profile user1]
region=us-east-1
output=text

In case of ElasticBeanstalk CLI - eb init --profile test will regenerate config.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment