AWS Config With Multiple Profiles

This uses the AWS CLI, go here for instructions on installing it https://aws.amazon.com/cli/

These instructions pertain to Mac users only.

Use aws configure to set the default user credentials. You will be prompted to add the user-key, secret-key (provided by AWS when you create the IAM user), the region (e.g. us-east-1), and the output (e.g. json).

The keys are stored in at ~/.aws/credentials

The region and output are store at ~/.aws/config

Use cat <path> to view these files in the console

Credentials or configs are separated by profiles. Default is initially loaded in to the environment variable AWS_PROFILE , to use a different profile, reassign this variable to the profile you wish to use, or add the --profile <profile-name> flag to you commands.

For using profiles other than the default, go here https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html#using-profiles

To set additional profiles you can add or update properties to a profile using the following command

aws configure set aws_access_key_id <user-key> aws_secret_access_key <secret-key> region <region> output <output> --profile <profile-name>

Use aws configure list-profiles to see all available profiles

For more info, go here https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html