My Cloud web interface is down, what do I do?
One key to operating in the cloud is being able to automate tasks and get things done when the GUI or the web interface you normally use is down. If you are using Amazon’s AWS, then one of the ways you can do this is by using their CLI tools. Setting these tools up on a windows machine can seem daunting, but it can actually be done in a couple of minutes using the simplified instruction below:
- Download and install Java Runtime Environment 6. You can get it here.
- Download and unzip the tools. You can get them here.
- Copy the contents you just extracted to C:\AWS. You should now have a “bin” folder directly under C:\AWS.
- Create a folder called “Keys” under C:\AWS.
- You now need to generate an x.509 certificate and download both the cert and the private key to C:\AWS\Keys.
a. To generate a x.509 cert:
i. Log into AWS
ii. Click the drop down arrow next to your name
iii. Click “Security”
iv. Scroll down to Access Credentials and select x.509 certificates
v. Generate a new cert
1. If you already have 2 certs then you will need to either inactivate one of them or track down the files
2. Make sure you download the Private Key when it asks you to because you cannot download it again, but you can download the cert as many times as you like. - Setup System Variables. Right click “Computer” in the start menu and select “Properties”. Click “Advanced System Properties” and then click the “Environment Variables” button at the bottom of the popup. Make sure to add these to the “System Variables”.
a. EC2_CERT = C:\AWS\Keys\YourCertFileName.pem
b. EC2_HOME = C:\AWS
c. EC2_PRIVATE_KEY = C:\AWS\Keys\YourPrivateKeyFileName.pem
d. JAVA_HOME = C:\Program Files\Java\jre6
e. Optional PATH = C:\AWS\BIN
f. Leave the popup open as we will need it again shortly - You should now be able to execute some AWS CLI commands
- Open and command prompt and go to C:\AWS\BIN
- Type C:\AWS\BIN\ec2-describe-regions and press “Enter”
a. You should see a list of regions and their URLS
b. Find yours and copy the URL for example US East 1 is https://ec2.us-east- 1.amazonaws.com - Setup one more System Variable
a. EC2_URL = https://ec2.us-east-1.amazonaws.com - You should now be able to run all of the EC2 commands
a. Try typing C:\AWS\BIN\ec2-describe-instances and pressing “Enter”
There is also an API and SDK you can use if you’re programmatically inclined. But this can get you up and running quickly and allow you to put together some scripts or batch files that will fill the gap while you develop a more customized and robust solution. In a future blog post we will cover automating tasks through batch files and scheduled tasks. While these are not ideal solutions, they will work in a pinch and for a large percentage of users will be more than adequate.
