EC2 Micro instance of RStudio
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
I wanted to see see if I could setup RStudio on a micro instance on Amazon EC2. I thought it would be nice to have my own instance running in the cloud and why not use AWS free usage tier to host it.
The first time I tried to create a micro EC2 instance with RStudio, I ran into some problems because I tried it with a “Quick Start” instance (Basic 64-bit Amazon Linux AMI 2011.02.1 Beta – AMI Id: ami-8e1fece7) which RStudio does not test and certify that their platform works correctly for. From their documentation:
Note that while it is likely that RStudio will correctly compile and install on your target platform the only platforms currently tested and certified are Ubuntu and RedHat/CentOS.
I decided to go with a micro instance of Ubuntu 11.04 (ami-1aad5273 – Ubuntu 11.04 Natty EBS boot – 64-bit) with R version 2.12.1 (2010-12-16) that I loaded using apt-get.
Creating the EC2 instance
Press ‘Launch Instance’ button
Select “Community AMIs”, aand search for ami-1aad5273
Select ‘Micro’ instance type, since the AWS free usage tier is for micro instances only.
Use the defaults on the ‘Advanced Instance Options’.
Enter a name for the instance so you know what it is from your AWS console.
Enter in a Key Pair. If you need help with this, see my previous posting on how to do this.
Enter in a Security Group with ports 22, 80, and 8787. You will need 8787 open for RStudio, and will need 80 open if you setup a proxy (highly suggested by RStudio). If you need help with this, see my previous posting on how to do this.
Then launch instance.
Logging on to your EC2 instance
Logging on to you EC2 instance can be done several different ways and quite different for each environment. Since I did this from a Windows machine, I posted instructions for how to SSH to your Amazon EC2 instance using a free tool called PuTTY. For the AMI we are using, the login will be ‘ubuntu‘.
Installing R and RStudio
I found the instructions to download RStudio from their server download page which also references the easiest way to download R using apt-get.
Install R on the instance
sudo apt-get install r-base
Add new user. This will be your login to RStudio. I chose ‘travis’, but you might want to change it…unless you really like my name.
sudo adduser travis
Install RStudio and start it.
wget https://s3.amazonaws.com/rstudio-server/rstudio-server-0.93.89-amd64.deb sudo dpkg -i rstudio-server-0.93.89-amd64.deb
Check to see if you can login from a browser using your the server address and port 8787. For this instance, my address was http://ec2-50-16-128-37.compute-1.amazonaws.com:8787
Now see if you can play around with your own personal cloud instance of RStudio
Running with a Proxy
Since I am running RStudio on a public network, the RStudio guys strongly recommended that I deploy RStudio behind another web server. They said that this will greatly improve performance and security, and have clear instructions in their documentation.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.