Setting EC2 Environment Variables in ~/.bash_login
Setting EC2 Environment Variables in ~/.bash_login
Section “Setting up the Tools”
of the Amazon EC2 Getting Started Guide explains how to set up environment variables, so that the EC2 tools find themselves
(EC2_HOME
), Java (JAVA_HOME
), the private access key file (EC2_PRIVATE_KEY
) and the certificate file (EC2_CERT
).
And they also suggest to change the PATH
variable, so that you can run EC2 commands from anywhere.
Of course, you do not want to set the environment variables every time you want to use the EC2 tools. I added the lines
below to ~/.bash_login
on my Mac, so that the environment variables are set everytime I open a terminal.
I installed the tools in ~/AWS/ec2-api-tools-1.3-24159
and the private access key file and the certificate file
reside in ~/.ec2
.
export EC2_PRIVATE_KEY=~/.ec2/pk-.pem
export EC2_CERT=~/.ec2/cert-.pem
export EC2_HOME=~/AWS/ec2-api-tools-1.3-24159
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
export PATH=$PATH:$EC2_HOME/bin