If you are working closely with AWS, with multiple customers, multiple accounts, you will love this app : Direnv.
Direnv will let you switch environment variables depending on the current folder you are browsing. It will be especially useful when you are using multi-customers AWS CLI ACCESS_KEY variables. Then you don’t need to run aws configure each time you need to switch credentials.
When you leave the path, direnv will unload variables, then you avoid any mistakes.
First, install direnv (macOS in my case):
|
|
Available, on Linux, Windows (Cigwin).
Second, you need to create a .envrc file
In the target directory, for example, the name of your customer, organize one folder per customer. create the .envrc file.
Fill it with your AWS_ACCESS_KEY and SECRET_ACCESS_KEY, and don’t forget to `chmod 600 at least.
Third, install the hook
In your .bash_profile file, add the following.
|
|
Fourth, allow your directory
for the child folders, just create .envrc with:
|
|
and so on…
That’s all folks!
zoph.