Manage AWS Access and Secret Key Environment Variables using Profile Names
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd/awsprof
credentials
.gitignore
.travis.yml
LICENSE
Makefile
README.md

README.md

awsprof

GoDoc  Build Status  Go Report Card  Coverage Status

awsprof is a little tool to quickly switch your AWS access and secret key environment variables using profile names. Many AWS tools and APIs support the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables, but they don't support the profile system - awsprof aims to help resolve that.

Install

Download a binary from the Releases page, or if you have a valid Go installation you can install from source:

$ go get github.com/KyleBanks/awsprof/cmd/awsprof

Usage

awsprof can be run with either no arguments to view the names of all configured profiles, or with a profile name to make the swap. If one of the profiles matches the current AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables, it will be marked as the active profile with an asterisk:

$ awsprof
 * default
   devops
   production
   website

Alternatively, running awsprof with a profile name allows you to activate the pair of AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables associated with that profile. Unfortunately, due to the nature of environment variables, and the fact that a child process cannot set environment variables for the parent, awsprof can only output the export commands which you can then run:

$ awsprof website
export AWS_ACCESS_KEY_ID='EXAMPLE'
export AWS_SECRET_ACCESS_KEY='EXAMPLE'

You can either copy and paste the command to run it yourself, or more efficiently:

$ eval $(awsprof website)

For frequent usage, add an alias to your ~/.bash_profile:

# ~/.bash_profile

alias awsprof-website="eval \$(awsprof website)"

And run it like so:

$ awsprof-website

Author

awsprof was developed by Kyle Banks.

License

awsprof is available under the MIT license.