Skip to content
This repository

Amazon

EC2

Quick Launch!

Once everything is setup, spawning new instances is easy!

ec2-run-instances --instance-type t1.micro ami-fd20ad94 --region us-east-1b --k bmeynell-keypair
ec2-allocate-address OR ec2-describe-addresses
ec2-associate-address -i <instance-id> <ip address>

Modify /etc/hosts as needed. Then login to new server.

ssh -i id_rsa-bmeynell-keypair ubuntu@<hostname>
sudo adduser bmeynell
sudo adduser bmeynell admin
sudo cp -R ~/.ssh /home/bmeynell
sudo chown -R bmeynell.bmeynell /home/bmeynell/.ssh

Logout of new server and log back in using new bmeynell account.

ssh -i id_rsa-bmeynell-keypair bmeynell@<hostname>

Setup

Download X.509 Certificate

  • Login to AWS
  • Visit the AWS Access Identifiers Page.
  • In the X.509 certificate section near the bottom, click Create New.
  • Download the private key file.
  • Download the X.509 certificate.

Download EC2 Command Line Tools

Move All Downloads to Central Folder

mkdir ~/.ec2
cd ~/Desktop
mv *.pem ~/.ec2
cd ~/Desktop/ec2-api-tools-1.3-19403/  #depends on ec2 tools folder name
mv * ~/.ec2

Setup Local Environment For Convenience

sudo vi ~/.bash_profile
export EC2_HOME=~/.ec2
export PATH=PATH:EC2_HOME/bin
export EC2_PRIVATE_KEY=pk-YOURKEYNAME.pem
export EC2_CERT=cert-YOURKEYNAME.pem
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home/
source ~/.bash_profile

Create New Instance

Ubuntu 11.10 From http://alestic.com/

ec2-run-instances --instance-type t1.micro ami-baba68d3 --region us-east-1 --k bmeynell-keypair

Authorize Ports (if applicable)

ec2-authorize default -p 22 
ec2-authorize default -p 80

Get Instance Information

ec2-describe-instances

Login

ssh -i id_rsa-bmeynell-keypair ubuntu@ec2-XX-XX-XX-XX.compute-1.amazonaws.com
ssh -i id_rsa-bmeynell-keypair ubuntu@aws-micro-1 (after /etc/hosts entry)

Create Static IP Address

ec2-allocate-address
ec2-associate-address -i <instance-id> <ip address>

Resources

How To: Getting Started with Amazon EC2

Something went wrong with that request. Please try again.