Skip to content

netrc and netrc.gpg support (store your passwords in a file)

Ted Zlatanov edited this page Jun 26, 2013 · 2 revisions

Setting up a .netrc file

The Unix convention of a .netrc file is alive and well in aws!

Create a .netrc file in your home directory with this line:

machine AWS username ignored login EC2_ACCESS_KEY password EC2_SECRET_KEY

From now on, aws will use the contents of that file if the standard EC2_ACCESS_KEY and EC2_SECRET_KEY environment variables are missing.

Encrypting .netrc with GPG

If you encrypt the file with GPG and give it the .gpg extension, aws will automatically decrypt it by calling GPG (which also means that if you're not on the terminal, aws will not work properly). Look into the GPG Agent if you need unattended operation.