Warning: I expect I’m going to want a little more control than this script provides shortly, because directory-level control of aws creds is probably not sufficient (if I want to deploy to dev/staging/prod, I’ll probably want different users to keep the environments completely isolated).  That will require some scripting, but for now, here’s what I’ve got.

  1. I’m going to use autoenv since I already use it for most of my development work anyway. Install that first
  2. AWS’s cli already supports the concept of profiles. Configure as desired
  3. Now, you can just drop a .env file in each directory with specific AWS credential needs, and include `AWS_DEFAULT_PROFILE=<your-profile>`

Done.