Catalogs of posts

Thursday, December 1, 2016

RStudio in the cloud with Amazon Lightsail and docker

About two years ago we published a quick and easy guide to setting up your own RStudio server in the cloud using the Docker service and Digital Ocean. The process is incredibly easy-- about the only cumbersome part is retyping a random password. Today the excitement in virtual private servers is that Amazon is getting into the market, with their Lightsail product. They are not undercutting Digital Ocean entirely-- in fact, their prices look to be just about identical. But Amazon's interface may have some advantages for you, so here's how to get Docker and RStudio running with Amazon Lightsail.



1. Log in to Lightsail

2. Create an Instance; choose the Base OS, and Ubuntu (as of this writing 16.04 LTS)

3. Name it what you like

4. Wait for boot up. Once it's running, click "connect" under the three dots. This opens a console window where you are already logged in, saving some headache vs. Digital Ocean.

5. Time for console commands. Type: sudo apt-get install docker.io Then Y for yes to add the new material.

6. Type: sudo service docker start

7. Now you can start your docker/rstudio container. See our earlier blog post or this link for resources. Shortcuts:

a. Plain Rstudio: sudo docker run -d -p 8787:8787 rocker/rstudio

b. All of Hadleyverse: sudo docker run -d -p 8787:8787 rocker/hadleyverse

c. Custom password: sudo docker run -d -p 8787:8787 -e USER=ken -e PASSWORD=ken rocker/hadleyverse

d. Enable root: sudo docker run -d -p 8787:8787 -e ROOT=TRUE rocker/rstudio

8. Important! While the container is starting, go back to the Lightsail tab in your browser and click in the three dots in the "Running" instance to Manage. then click on the Networking tab. In the table of two enabled ports, click on the plus "Add Another". Leave "Custom" and "All" under "Aplication" and "Protocol", repectively, and change port range to 8787. Save.

9. The public IP is printed on the Networking page there. Cut and paste into your browser with :8787 appended. Your username and password are both rstudio, unless you changed them. To allow additional users onto your cloud server, see this page.

An unrelated note about aggregators: We love aggregators! Aggregators collect blogs that have similar coverage for the convenience of readers, and for blog authors they offer a way to reach new audiences. SAS and R is aggregated by R-bloggers, PROC-X, and statsblogs with our permission, and by at least 2 other aggregating services which have never contacted us. If you read this on an aggregator that does not credit the blogs it incorporates, please come visit us at SAS and R. We answer comments there and offer direct subscriptions if you like our content. In addition, no one is allowed to profit by this work under our license; if you see advertisements on this page, the aggregator is violating the terms by which we publish our work, except as noted above.

2 comments:

  1. Hi Edward-- I think this is easier/quicker. I only need to install one program in Linux (in Amazon-- none if I use Digital Ocean). And the different docker images have various packages pre-installed, which I think might save a lot of time for a casual user.

    ReplyDelete
  2. Thank you for this amazing post. I manage to get it up and running and hit a snag. To enable ports, you now need to add "Custom", "-1" and "0 - 65535" under Application, Protocol, Port range respectively. Seems that Amazon Lightsail just tweaked something at their end.

    ReplyDelete

Note: Only a member of this blog may post a comment.