This packages helps build a collection of files necessary to submit a R function to AWS lambda. Today only works in a linux environment.
The present work is based on this repo
After the elucidative article that Takashi Iwamoto made. I, and my collegue Lucas, only built functions to search of packages used in .R lambda and its dependencies. We use the structure and code provided by Iwamoto.
You use only a function with two arguments. One is the path that will contain all files that the function will create. The second argument is the path of your function, a .R file.
Let's say that you have a folder to receive all the files and a already built function in a .R file.
In a R environment
lambaRt::build_files("./test/output/", lambda = "./test/function_test/test.R")
That generate all the necessary files to build you lambda file.
Dockerfile: This build a image with necessary packages and R base using a lambci image. CAUTION If you use a R package that has some system requirements you need to edit that by hand.
Bootstrap: A Shell script that will be executed at call of lambda. It makes a request in lambda API to get event data, pass that to the R function, capture the response que send back to lambda API
zip_function: This shell script will copy every binary that base R uses, your function and necessary libraries to a zip file to be submited to AWS Lambda. CAUTION If you use a R package that has some system requirements you need to edit that by hand (eg: Shared libs).
Build: This little guy will build a image using the Dockerfile created earlier. After that will run the image mount the current folder and executing zip_funcion.sh as command, creating the zip file. You need to execute this guy by hand
With that zip file you can create a AWS Lambda with R runtime.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.