Skip to content

Deployment

An application deploys its workers and dispatcher in one CloudFormation stack, named after the project, holding the functions, their IAM roles and their log groups.

The examples below deploy map-lambda's own project, which is the dispatcher and echo - a simple example function that returns its input.

Deploying needs AWS credentials and a region, which are found in the same way as the aws CLI. --region overrides the region.

Deploying from a release

This needs only uv, not Rust: the Python wheels come from PyPI, and the lambda zips from the matching GitHub release.

uvx --python 3.12 --from 'map-lambda[deploy]' map-lambda-deploy deploy

This lists everything it will change, then asks for confirmation before creating the CloudFormation stack. --python 3.12 is needed where the default Python is older, as it is in CloudShell.

To check it works, run echo through the deployed dispatcher:

uv run --python 3.12 --no-project --with map-lambda python -c '
import asyncio, map_lambda

async def main():
    async for index, output in map_lambda.map_unordered("echo", [1, 2, 3], input_key="i", project="map-lambda"):
        print(index, output)

asyncio.run(main())
'

The same commands work in AWS CloudShell, which has credentials and a region already set, once uv is installed:

curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.local/bin/env
export UV_CACHE_DIR=/tmp/uv-cache   # CloudShell's home directory is limited to 1 GB

Seeing what is deployed

uvx --python 3.12 --from 'map-lambda[deploy]' map-lambda-deploy list

Deleting it

uvx --python 3.12 --from 'map-lambda[deploy]' map-lambda-deploy delete

Deploying from source

From a checkout, building the zips needs Rust, Zig and cargo lambda:

uv run python -m map_lambda.deploy deploy --from-source

A plain deploy from a checkout refuses to use a release's zips, as they needn't match the checked-out code. list and delete work from a checkout as uv run python -m map_lambda.deploy list and uv run python -m map_lambda.deploy delete.