The _lambdar.yml file can be used to customise your container image. Lambdar tries to populate as much information as it can, but if you need to override any options you’re welcome to do so. You can also write your own Dockerfile and use lambdar to build it if you prefer.

Config options

aws_account_id and aws_region

Lambdar uses these when it talks to AWS. This information is needed to:

  • Authenticate with AWS so lambdar can run docker push and upload your container.
  • Construct the URL of your ECR (Elastic Container Registry) repository, which is where your container will be stored.
  • Create the lambda function from your container (this isn’t implemented yet).

If you don’t supply this information you can still build a container if you have Docker installed, or build a Dockerfile if you don’t.

# _lambdar.yml

aws_account_id: "123456789012"

aws_region: "ap-southeast-2"

app_name

This is used to name (via docker tag) your container when it’s built. It also forms part of the ECR repository URL.

# _lambdar.yml

app_name: "my-first-lambdar-app"

r_version

This tells lambdar what version of R to install in your container. Lambdar pre-fills this with your current R version, but you can change it if you need to. Make sure you specify all three digits of the version number, e.g. "3.6.3".

# _lambdar.yml

r_version: "4.1.1"

r_packages

Any packages listed here will be installed when the container is built. Lambdar will try and determine which packages you need using renv::dependencies() and will auto-fill this list.

# _lambdar.yml

r_packages: [ tidyverse, units ]

linux_packages

If you need any extra system libraries installing, mention them here. The base AWS image is based on CentOS, so packages will be installed by yum.

# _lambdar.yml

linux_packages: [ udunits2-devel ]

Lambdar can’t work out which Linux package you need so this section is up to you.

env

If your code needs any specific environment variables, enter them here. At the moment yaml lists are not supported because they don’t translate to the correct data structure in R, so copy the examples in the template.

# _lambdar.yml

env:
  LAMBDAR_APP_NAME: "my-lambdar-app"
  LAMBDAR_VERSION: "0.1.0"
  LAMBDAR_LOG_LEVEL: "INFO"

Lambdar environment variables

The three default environment variables are shown above. At the moment only LAMBDAR_LOG_LEVEL has any effect - it sets the log level for the logger package, which the runtime uses to, well, log stuff. The default if this variable is not defined is logger::INFO.