Sign inSign up

wolframresearch/aws-lambda-wolframlanguage

By wolframresearch

•Updated 4 months ago

Image
1

2.2K

wolframresearch/aws-lambda-wolframlanguage repository overview

⁠Wolfram Language runtime for AWS Lambda

⁠Introduction

The Wolfram Language runtime for AWS Lambda⁠ is a Lambda container image runtime⁠ that allows you to write Lambda functions⁠ using the Wolfram Language⁠.

You can use the WL Lambda runtime to deploy your Wolfram Language code scalably in AWS' global infrastructure and integrate it with other applications and clients both within and outside of the AWS cloud.

You can also integrate the WL Lambda runtime with Amazon API Gateway⁠ to host Wolfram Language-based web applications, such as APIs⁠ and web forms⁠, on AWS Lambda.

⁠Quick reference

⁠Function modes

The WL Lambda runtime supports two main modes of operation:

⁠Raw mode (walkthrough »⁠)

Raw-mode functions behave like conventional Lambda functions written in languages such as JavaScript⁠ and Python⁠. Raw-mode functions are written as ordinary Wolfram Language functions. Raw-mode functions accept JSON data as input and return JSON or binary data as output.

A raw-mode Lambda function can be written as a pure function accepting an association of deserialized JSON data, like:

Function[<|
    "reversed" -> StringReverse[#inputString]
|>]

This function would accept input JSON like:

{"inputString": "Hello World"}

...and return as output (automatically serialized to JSON):

{"reversed": "dlroW olleH"}

Raw-mode functions can be invoked⁠ using the AWS Lambda API⁠; AWS SDKs⁠, the AWS CLI⁠ and other AWS tools; and other AWS services⁠ such as Lex⁠, S3⁠ and SNS⁠. Wolfram Language clients can invoke arbitrary Lambda functions using the AWS service connection⁠.

For a complete walkthrough of deploying an raw-mode function, see the raw mode example⁠. The template and code in this example can be adapted for your own applications.

⁠HTTP mode (walkthrough »⁠)

HTTP-mode functions are intended to integrate with an Amazon API Gateway⁠ API and proxy integration⁠. Much like applications using the Wolfram Web Engine for Python⁠, HTTP-mode functions are written using high-level HTTP-aware primitives such as APIFunction⁠ and FormFunction⁠. Any primitive supported by the Wolfram Language function GenerateHTTPResponse⁠ can be used in an HTTP-mode function. HTTP-mode functions accept HTTP request data as input and return HTTP response data as output.

An HTTP-mode Lambda function can be written using Wolfram Language HTTP-aware primitives, such as FormPage⁠:

FormPage[
    {"image" -> "Image"},
    ImageEffect[#image, "Charcoal"] &
]

When deployed to AWS Lambda and Amazon API Gateway, the form page is accessible in a web browser via an API Gateway URL:

HTML page served by a FormPage in an HTTP-mode Lambda function

HTTP-mode functions can be invoked via API Gateway by a web browser or any HTTP-capable program, including by Wolfram Language-based clients.

For a complete walkthrough of deploying an HTTP-mode function, see the HTTP mode example⁠. The template and code in this example can be adapted for your own applications.

⁠Container image information

⁠Supported image tags
⁠Image variants
⁠wolframresearch/aws-lambda-wolframlanguage:latest

Base: wolframresearch/wolframengine:latest⁠
This image is based on the latest tag of the wolframresearch/wolframengine image, and hence contains the latest version of the Wolfram Engine⁠.

Tag summary

Content type

Image

Digest

sha256:d1f572af7…

Size

3.3 GB

Last updated

4 months ago

docker pull wolframresearch/aws-lambda-wolframlanguage