0.1.1 • Published 9 years ago

professor v0.1.1

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
9 years ago

Professor

Processor is a happy little tool for doing things with AWS credentials. Using standard AWS config files, you can specify AWS keys in profiles and then use the professor to do any of the following:

  • Export AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY for a given profile.
  • Run a command with AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY set.
  • Print out a Redshift COPY command credspec (because I'm so sick of typing that out).

Also, this probably doesn't work in anything but bash, because the source script takes an argument.

Usage

$ npm install -g professor

This will get you two things:

1) A script to source with a profile parameter to export keys to your current bash shell. 2) A professor command.

Commands:
  run       Run a command with the given AWS profile
  credspec  Get a credspec suitable for passing into a Redshift COPY command
  source    Print the command you can use to source the professor

Options:
  -h, --help  Show help                                                [boolean]

Running with just one positional argument makes professor
spit out the access key and secret associated with the profile
named by that argument, for usage by the source script.

In order to use the fanciful just-export-my-creds feature, you need to setup an alias in your .bashrc or .profile file:

alias prof=$(professor source)

Now you can do prof default to export your creds! You can run professor source yourself to see what it does:

$ professor source
. /Users/Anthony/.nvm/versions/node/v0.12.2/lib/node_modules/profess/bin/professor

It simply prints out a source command that'll source our script. The alias makes it look like a normal command.

Using profess looks like this:

# Run with a profile called 'default'
$ professor run default someprogram some args

Profess gets these profiles via the node AWS sdk, and it sources them from ~/.aws/credentials. It expects a file format like this:

[default]
aws_access_key_id = something
aws_secret_access_key = somethingelse

[preview]
...

Enjoy!