8 $ sudo apt-get install ec2-api-tools ec2-ami-tools
9 $ brew install ec2-api-tools ec2-ami-tools
13 $ brew info ec2-api-tools
15 * Before you can use these tools you must export some variables to your $SHELL
16 and download your X.509 certificate and private key from Amazon Web Services.
18 * Your certificate and private key are available at
19 [aws-portal.amazon.com](http://aws-portal.amazon.com/gp/aws/developer/account/index.html?action=access-key).
21 * Download two `.pem` files, one starting with `pk-`, and one starting with `cert-`.
22 You need to put both into a folder in your home directory, `~/.ec2`.
26 # To use public images (AMI's), you need an SSH keypair from EC2.
27 ec2-add-keypair my-keypair > ~/.ec2/my-keypair.pem
28 chmod 600 ec2-keypair.pem
32 # Start an instance using a given AMI image:
33 # (Use the Ubuntu locator, or ec2-describe-images)
34 ec2-run-instances ami-xxxxxx -k ec2-keypair
36 # Open up ports (in the 'default' security group):
37 ec2-authorize default -p 22
38 ec2-authorize default -p 80
41 ssh -i ~/.ec2/my-keypair.pem root@ec2-xxx.amazonaws.com
45 # Show running instances
46 ec2-describe-instances
49 ec2-terminate-instances i-yourinstance
53 # Create a security group
54 ec2-add-group group_name -d "Description"
56 # Show images (AMI's) owned by amazon, or me
57 ec2-describe-images -o self -o amazon
61 * [Ubuntu EC2 AMI locator](http://cloud-images.ubuntu.com/locator/ec2/)
63 ### Change certificates
65 EC2_CERT_PATH="$HOME/.ec2"
66 export EC2_PRIVATE_KEY="$(/bin/ls $EC2_CERT_PATH/pk-*.pem | /usr/bin/head -1)"
67 export EC2_CERT="$(/bin/ls $EC2_CERT_PATH/cert-*.pem | /usr/bin/head -1)"