Getting Started with Ubuntu and R on Amazon’s EC2 cloud

Amazon EC2 is their “cloud” service, which means that you can run a virtual machine on their hardware. They have many basic VMs, which they call AMI, that you can use to start and setup your machine with the configuration and software that you need.

New accounts, since October 2010, on Amazon Web Services can have a year of free services of the basic varieties of their services. For example, they offer 5GB on the S3 storage and a “micro” virtual machine on their EC2 platform. The micro has a single Xeon E5430 2.66GHz CPU, 613 MB of RAM and 8GB of disk space. It is not much, but you can use it to play and learn to use EC2. You can also setup a machine configuration and then save it as an image (AMI) to create more powerful machines from that configuration.

Please note that, even when the Micro instance is free for a year, there can be charges, small, but be prepared. Network traffic and IO were two categories that I ended up having to pay for (less than $1, but it will depend on your code). So, give it a try and keep an eye on your account information to keep track on these extra charges while you learn what to expect.

Ubuntu has official AMI on the EC2. Just search for those owned by Amazon ID ‘099720109477’. For example, their list of AMIs for Ubuntu 10.04 (Lucid Lynx) list the AMI ID, the 64-bit version has the ID: ami-3202f25b

From the EC2 Management Console, under the “Instances” (Virtual Machines) menu, click on Launch Instance. This will show a menu, select the “Community AMI” tab and paste the ID of the AMI you want to start using:

On the next page, select the type of machine, in this case a Micro (check this page for the current pricing):

The create a key pair. You will need this to log in via SSH, there are no passwords and the machine will have a single account called ‘ubuntu’:

Then, select a security group, which is the firewall settings. You can have several, but at least have SSH open to allow you to connect!

Then, the summary screen:

Click “Launch”, the machine will appear on the Instances menu as “pending” while it boots.

Once it boots, the status will read “running”:

Right-click on it and select Connect:

It will give you the login command you should use to connect via SSH and using the previously downloaded key. Note that for ubuntu, you should change the username in the command from ‘root’ to ‘ubuntu’.

Then connect using the keypair .pem file:

Then, just install R using apt-get, for example, this command will install r-base (the base R) and its dependencies:

sudo apt-get install r-base

Note, the screenshots above are a 10.10 machine, but at the time of this writing, the Ubuntu 10.10 AMIs have some issues, sometimes it is not available after boot. Use the 10.04 AMI and then upgrade to 10.10.

This entry was posted in Cloud Computing, R, Ubuntu. Bookmark the permalink.