The minimum you need to get Node running in a container using Amazon's image.
Note: this repository is not affiliated with Amazon.
Containers currently have about 10gb space to use, whereas zip functions have about 250mb. So for many interesting use cases you will need to use a container.
This template exists because it is actually fairly hard to find pre-made lambda containers that work. Many lambda container images on GitHub don't work, including starter kits and templates. The other containers don't work because they don't use Amazon's image and so no longer implement the latest runtime interface.
docker build -t <image name> .
- or
docker build --platform linux/amd64 -t <image name> .
for amd64 - or
docker build --platform linux/arm64 -t <image name> .
for arm
- or
docker run -p 9000:8080 <image name>
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"payload":"Hi"}'
- Go to the AWS ECR Console (Elastic Container Registry)
- Go to Repositories
- Create a repository
- Click "view push commands" within the repository
- Run the commands the panel describes in a shell in the project folder
- this builds the Docker container and pushes it to AWS ECR
- Go to the AWS Lambda Console
- Go to Functions
- Create a function
- Choose "container image" at top
- Click "Browse Images"
- Click reload button and click "select repository"
- Select the repository and image
- Select the appropriate architecture etc
- Test
- Test with the test tab
- In configuration tab create a Function URL