Skip to content

Instantly share code, notes, and snippets.

jamesmaino /
Last active May 17, 2024 10:36
Create a Plumber API for R code hosted on AWS EC2

Deploying an API for an R code base with {plumber} and AWS

This post is largely built around a tutorial by Martin Lukac but this tutorial did not set up a persistent API service so some final steps are adapted from the plumber documentation.

Setup the AWS instance

You start by logging into your AWS account. Once in, you select an RStudio Amazon Machine Image (AMI) from this link. You are free to choose any, but it's more efficient to choose based on your geography. The Rstudio service is actually not really necesary, as all the steps can be done directly from the terminal, but some users might feel more comfortable with it.

Once in AWS, you have to select the machine you want to run it on. AWS EC2 has a free tier option called t2.micro, and that's the one I will be using here. Click Review and Launch

jamesmaino / gist:0e459d2d979d36422ed40e89f5301cea
Last active August 16, 2022 02:10
Create new R shiny app in vscode

Create new R shiny app in vscode

Increasingly I am using vscode instead of RStudio for a consistent coding experience across languages. Here is how to start a new shiny app.

Make a ui.R script to hold the interface.

# Define UI for app that draws a histogram ----
ui <- fluidPage(
jamesmaino /
Last active February 22, 2023 02:32
Handy github commands

Create new git with github repo from command line

gh repo create --source=. --public
git init -b main
git add . && git commit -m "initial commit"
git remote add origin<REMOTE_PATH>.git
git push 

If you are modifying a cloned repo and what to change the remote origin you personal account use the following.

jamesmaino /
Last active September 19, 2022 04:41
Guide to creating a shiny server on AWS that hosts spatial apps with persistent storage

How to install a simple shiny server for spatial apps on AWS with Ubuntu

Set up an AWS instance

Create an AWS account. Go to the EC2 dashboard. Set up an instance using the free tier by selecting AMI Catalog in the following menu Select Ubuntu Add 30 gb of SDD