How do I deploy my plumber API?

Learning objectives:

  • Deploy a {plumber} API to Posit Cloud.
  • Deploy a {plumber} API to Posit Connect.
  • Deploy a {plumber} API to DigitalOcean with {plumberDeploy}.
  • Run a {plumber} API in a Docker container.
  • Manage a Dockerized {plumber} API with Kubernetes (K8s).
  • Deploy a K8s {plumber} API to GCP.
  • Deploy a K8s {plumber} API to AWS.

Posit Cloud

  • Free tier available
  • Deploying: (relatively) Easy & Free
  • Using: Difficult
    • Load API in browser
      • Login to
    • Copy cookie (see How do I tell the API who I am)
    • Paste cookie into file
    • Use file with httr2::req_cookie_preserve()

Posit Cloud: Demo

deploy_api <- function(package, name, appName = name, ...) {
  api_dir <- withr::local_tempdir("api")
  file_path <- paste0(api_dir, "/entrypoint.R")
  entrypoint_text <- glue::glue(
    'plumber::plumb_api("{package}", "{name}")',
    .sep = "\n"
  writeLines(entrypoint_text, file_path)
  rsconnect::deployAPI(api_dir, appName = appName, ...)
# Login to; click your name, then Account, then Tokens
# + New Token, or Copy existing token, and follow instructions
deploy_api("yourPackage", "yourAPI")

Posit Connect

  • Posit Connect = paid enterprise service
  • Deploying: Identical to Posit Cloud (just different token)
  • Using: Easy
    • No hurdles other than what your IT creates


TODO: Does this still work? No updates in 2.5 years


TODO: Add the hard things. The free/“easy” ones ate the day!

Meeting Videos

Cohort 1

Meeting chat log