Amazon EC2 Tools access behind a Corporate Firewall
In keeping with my previous post about the excellent corporate firewall tool called Cntlm I thought I would provide an example of how you may wish to use this tool on a Linux environment ( though it may work fine in windows )
Amazon EC2 instances can be manipulated via a set of Java client applications called EC2 API Tools. These tools provide as much functionality as the standard Amazon Web Service Interface, however they are command line driven, hence they provide a perfect mechanism for scripting the management of your EC2 Instances.
This works very well, however in a corporate world you may be behind a internet proxy, which can play havoc with your scripts.
So, after you have installed the tools, you can follow these steps to get your EC2 tools running.
First start up cntlm.
cntlm -l 9090 -u <youruserid>@<yourdomain> -p <your password> <domain of your proxy>:<proxy port>
This starts up cntlm and establishes a listener on port 9090
Second, set up some environment variables for EC2 Tools
# Amazon tools
export EC2_HOME=<where you have installed EC2 tools>
export PATH=$EC2_HOME/bin:$PATH
export AWS_ACCESS_KEY=<get this from your Amazon Account web page>
export AWS_SECRET_KEY=<get this from Amazon Account web page>
# The EC2 URL may be different for you
export EC2_URL=https://ec2.ap-southeast-1.amazonaws.com
# Set up some JVM Args to tell the EC2 tools to talk to your local CNTLM proxy and not the corporate internet proxy
export EC2_JVM_ARGS="-DproxySet=true -DproxyHost=localhost -DproxyPort=9090 -Dhttps.proxySet=true -Dhttps.proxyHost=localhost -Dhttps.proxyPort=9090"
If all goes well you should be able to access your EC2 instances via the Amazon tools.
Comments
Post a Comment