Effectively Running R scripts from AWS Lambda Functions

Ramon Marrero
Geek Culture
Published in
8 min readAug 22, 2021

--

Learn to run your R scripts using AWS Lambda and container images

Photo by Nubelson Fernandes on Unsplash

AWS Lambda supports several languages via runtimes. At the time of writing, the AWS Lambda supported runtimes are: Node.js, Python, Java, C#, Ruby, Go, and PowerShell.

This makes things difficult for developers or data scientists that usually developed using R as their main programming language. Until now, most efforts for creating AWS Lambda functions compatible with R were made using layers.

As AWS recently announced support for container images, we are now able to package and deploy Lambda functions as container images. This allows developers to build and deploy larger workloads that rely on sizable dependencies. It also allows for R scripts to be deployed using R container images on AWS Lambda functions.

In this post, we will quickly explore how to run R scripts from AWS Lambda functions using container images. We will create a custom runtime for R and deploy our service using AWS CDK.

If you find this article helpful, please do not forget to like or comment below. I enjoy actively participating with readers.

Lambda Container Images

We will rely on the Docker CLI and the Amazon Elastic Container Registry service…

--

--

Ramon Marrero
Geek Culture

Head of Data Engineering | AWS Community Builder | AWS Certified Solutions Architect | Google Cloud Certified Professional