AWS + Docker + RStudio

In this post you will see how to run a Dockerized R development environment in the cloud. Lately I have been exploring Docker and R. It seemed logical to see how these could be run together in the cloud. Here we go!

But hey, why would you do this?

Well, combine the benefits from Docker containers and cloud computing. Benefits include for example portable and easy-to-share environments, flexible resources, scalability, version control and low initial investments.

Why would someone not do this?

There is data sensitivity, legal concerns, change in the established processes, organizational issues and RStudio server’s commercial license (9995$ :/).

Clearly there are pros and cons. How do these balance out in your case? Anyway. If you want to give it a try, this is how you do it 😀

1) Get an AWS instance that suits your needs

Check out technical and financial information on different instances and make you choice.

2) Install Docker to the AWS Ubuntu instance

Docker website offers an extensive guide.

3) pull Rocker RStudio image from Dockerhub (as 100k+ others have already)

docker pull rocker/rstudio

Rocker has a handy guide for using the image. The guide is definitely worth skimming through. You will learn a lot about Docker in general too.

4) Run image

sudo docker run -d -p 8787:8787 rocker/rstudio

This command runs the image detached and forwards container’s port 8787 to host’s port 8787. The thing will not work out without the forwarding.

You can set custom users and passwords at this step. See the image guide for detailed information on custom usage and multiple users.

5) Connect to the (throw away) server with your browser

http://xxx.xxx.xx.xxx:8787

6) Log in with your username and password

rstudio_login

7) Start developing and have fun!

rstudio_logged