Skip to content

Instantly share code, notes, and snippets.

@khturner
Created April 24, 2019 02:02
Show Gist options
  • Save khturner/0a2607758005105f74d919cfc0cfff77 to your computer and use it in GitHub Desktop.
Save khturner/0a2607758005105f74d919cfc0cfff77 to your computer and use it in GitHub Desktop.
A quick template for booting up a fresh EC2 instance with RStudio Server running

Provision EC2 instance

  • Use AMI Ubuntu Server 18.04 LTS (HVM), SSD Volume Type - ami-005bdb005fb00e791 (64-bit x86)
  • At least a t2.medium
  • At least 30 GB Root volume
  • Set up TCP port 22 and port 8787 (RStudio server) access for my IP
  • Tag with Name = turbo-rstudio
  • Use the turbo-rstudio keypair
    • You already have this .pem file in your ~/Downloads/ dir, already did chmod 0400

Connect (from your Chromebook in this example)

  • Open a shell, run ssh -i /home/chronos/user/Downloads/turbo-rstudio.pem ubuntu@ec2-34-213-182-15.us-west-2.compute.amazonaws.com
    • Obvi, switch the URL for this instance's URL
  • When connected, run this block:
sudo apt-get update
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9 
sudo apt-add-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'
sudo apt-get -y install r-base r-base-dev gdebi-core wget libxml2-dev libcurl4-openssl-dev libssl-dev default-jre default-jdk
wget https://download2.rstudio.org/server/bionic/amd64/rstudio-server-1.2.1335-amd64.deb
sudo gdebi rstudio-server-1.2.1335-amd64.deb
sudo R CMD javareconf
sudo passwd ubuntu # make it 'ubuntu'
  • Open in a web browser: http://ec2-34-213-182-15.us-west-2.compute.amazonaws.com:8787
  • Run install.packages(c("tidyverse", "ggsci")) cause it takes forever

Other stuff you'll likely want to do

  • install.packages("doParallel")

  • install.packages(c("bayesAB", "lmerTest", "BayesFactor"))

  • install.packages("caret")

  • install.packages("bartMachine")

  • This whole thing will take up about 4GB of space on the root partition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment