Skip to content

Instantly share code, notes, and snippets.

@micmath
Created November 15, 2019 11:47
Show Gist options
  • Save micmath/b2885073993022d9adaf4b9d7db678e9 to your computer and use it in GitHub Desktop.
Save micmath/b2885073993022d9adaf4b9d7db678e9 to your computer and use it in GitHub Desktop.
$ aws configure --profile mycoolproject
$ aws configure list --profile mycoolproject
      Name                    Value             Type    Location
      ----                    -----             ----    --------
   profile                  mycoolproject     manual    --profile
access_key     ****************FAKE shared-credentials-file    
secret_key     ****************FAKE shared-credentials-file    
    region                eu-west-1      config-file    ~/.aws/config
@micmath
Copy link
Author

micmath commented Nov 15, 2019

To use a named profile, add the --profile yourprofilename option to your command. The following example lists all of your Amazon EC2 instances using the credentials and settings defined in the mycoolproject profile.

$ aws ec2 describe-instances --profile mycoolproject

To use a named profile for multiple commands, you can avoid specifying the profile in every command by setting the AWS_PROFILE environment variable at the command line.

$ export AWS_PROFILE=mycoolproject

Setting the environment variable changes the default profile until the end of your shell session, or until you set the variable to a different value. (You can make environment variables persistent across future sessions by putting them in your shell's startup script.)

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