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_SECRET_ACCESS_KEY environment variables, but they don't support the profile system -
awsprof aims to help resolve that.
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
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_SECRET_ACCESS_KEY environment variables, it will be marked as the active profile with an asterisk:
$ awsprof * default devops production website
awsprof with a profile name allows you to activate the pair of
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 alias awsprof-website="eval \$(awsprof website)"
And run it like so:
awsprof was developed by Kyle Banks.
awsprof is available under the MIT license.