How to run a quick throwaway Ubuntu EC2 instance
Time was, when you wanted to experiment or test something on Ubuntu, you needed a fresh install (best-case—a snapshotted virtual system). Nowadays, I myself prefer the convenience and negligible cost of simply firing up an Alestic community machine images. Once I’ve completed my work (perhaps pushing changes to a remote Git repository), I simply terminate the instance and call it a day.
Here is a comprehensive procedure detailing exactly the steps required to get an Ubuntu desktop running in a few minutes’ time. The tools used are Elasticfox to manage EC2, NoMachine’s NX client for remote login, and command-line SSH for odds and ends.
Contents
- Objectives
- Preparation (One-Time Only)
- Booting Ubuntu Intrepid
- Initial Setup
- Connect to the instance desktop
- Reminders
Objectives
- Be able to start up any number of Ubuntu 8.10 Intrepid desktop at a moment’s notice.
Preparation (One-Time Only)
These steps will get you up and running with Amazon’s AWS infrastructure. Do this only once, during your first run through this procedure. Afterwards, skip to the next section.
Install the NX client
Install the NX client (which is similar to the rdesktop VNC client) onto your local system:
- Go to the NX download page.
- Click on the link for the architecture and package type of your local system
- Install the client and node packages (server is not needed)
Set up NX client for EC2
Set up an NX session which is configured to connect to EC2 and establish a GNOME session.
- On your local GNOME system, Applications -> Internet -> NX Client for Linux -> NX Connection Wizard
- Name the session (e.g. EC2)
- Enter any random hostname (it will be changed later) for the host field and hit Next
- In the dropdowns, select a Unix system, GNOME desktop and hit Next
- Disable the “Create shortcut” option and click finish
Install Elasticfox
- Run Firefox and go to the Elasticfox page
- Click the “Download” button and install the extension
- Restart Firefox
Input account credentials in Elasticfox
- First, get your AWS account credentials:
- Go to the AWS site
- Mouse over “Your account” and click on “Access Identifiers”
- (Possibly sign in to Amazon)
- The access key is displayed; and you can click on the “Show” link to view your secret key
- Back in Elasticfox, click the “Credentials” button at the top
- Specify an account name (e.g. “Me” or “Business” or whatever)
- Copy and paste the access key and secret key into the form and click the “Add” button
Set up an SSH keypair
- In Elasticfox, click the “KeyPairs” tab
- Click the green “Create” button
- Specify a name for the pair (e.g. “EC2”) and hit OK
- A file download will initiate (e.g. named “id-EC2”). Save the file in ~/.ssh/
- Edit (or create) the file ~/.ssh/config
- Add the line:
IdentityFile ~/.ssh/id-EC2
Set up firewall rules
- In Elasticfox, click the “Security Groups” tab
- Click green ”+” button to add a group
- Set a group name and description (both are required)
- Select “I will authorize protocols for this group as needed” and hit “Create Group”
- An “Add New Permission” window will pop up automatically
- Select “SSH” for the protocol
- Select “Network” and set the value to 0.0.0.0/0 and click “Add”
- Allow ICMP ping
- Select the new group and click the green check button to add another rule
- Protocol Details = “Other”
- Protocol = ICMP
- ICMP type = 8
- ICMP Code = 0
- Select “Network” and set it to 0.0.0.0/0 and click “Add”
- For any other TCP port you may need
- Select the new group and click the green check button to add another rule
- Protocol Details = “Other”
- Protocol = TCP/IP
- Port range = (lower port number) to (higher port number)—or enter the same port twice to have no range
- Select “Network” and set it to 0.0.0.0/0 and click “Add”
Booting Ubuntu Intrepid
This step is where you actually boot Ubuntu as an Amazon instance.
- In Elasticfox, go to “AMIs and Instances” tab
- Click the blue “refresh” button and wait for it to load
- Enter the Alestic Ubuntu Intrepid image id:
- For 32-bit: ami-7dfd1a14
- For 64-bit: ami-bdfe19d4
- Select the AMI and click the green power button to launch
- Select the instance type. The cheapest types are as follows:
- For 32-bit: m1.small
- For 64-bit: m1.large
- Select or confirm the correct key pair (e.g. “EC2”)
- Click the right/left arrow buttons to have your desired firewall group as the only one in the right side
- Click Launch
- Click the blue refresh button under “Your Instances” until the instance is in a green running state
Initial Setup
- Once the instance is running, right click the it and select “Copy public DNS name to clipboard”
- In a terminal, type “ssh root@”, and then paste the DNS name, hit enter, and type yes to accept the server’s key. Login should happen automatically using the keypair
- Run:
apt-get update && apt-get -y upgrade
- Run
user-setup
Enter a username and password (I use simple ones since the instance will be terminated shortly) and take the default to whatever other prompts come up
Connect to the instance desktop
- In your GNOME, Applications -> Internet -> NX Client for Linux -> NX Client for Linux
- Select the session (e.g. “EC2”) and click the “Configure” button
- Delete the old hostname and paste in the new instance’s public DNS name
- Possibly set the display size to something manageable like 1024×768, otherwise it will run maximized
- Click Save, then click OK
- Enter the username and password for the instance’s user created in the previous step
- Click Login. NX will SSH in and the remote GNOME desktop will come up shortly.
- Enjoy!
Reminders
Remember to terminate the instance in Elasticfox when you are finished. Since termination will permanently delete all filesystem data, make sure you copy any important work off the system before terminating.
Posted in Free Software One Comment »

Wednesday, May 27, 2009 at 9:03 am
[...] How to run a quick throwaway Ubuntu EC2 instance | Proven Corporation Blog – [...]