To set up the runtime interface emulator for x86-64 architecture, follow these steps:
-
Create a directory for the emulator and download it from GitHub to your local machine:
mkdir -p ~/.aws-lambda-rie && \ curl -Lo ~/.aws-lambda-rie/aws-lambda-rie https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie && \ chmod +x ~/.aws-lambda-rie/aws-lambda-rie
To set up the runtime interface emulator for ARM64 architecture, follow these steps:
-
Create a directory for the emulator and download it from GitHub to your local machine:
mkdir -p ~/.aws-lambda-rie && \ curl -Lo ~/.aws-lambda-rie/aws-lambda-rie https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie-arm64 and chmod +x ~/.aws-lambda-rie/aws-lambda-rie
Once you've set up the emulator, you can start the Docker image using the docker run
command. Make sure to note the following:
docker-image:test
represents the image name and tag.aws_lambda_ric lambda_function.LambdaFunction::Handler.process
specifies theENTRYPOINT
andCMD
from your Dockerfile.
Here's an example command for both x86-64 and ARM64:
DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run -d -v ~/.aws-lambda-rie:/aws-lambda -p 9000:8080 \
--entrypoint /aws-lambda/aws-lambda-rie \
docker-image:test \
aws_lambda_ric lambda_function.LambdaFunction::Handler.process
DOCKER_DEFAULT_PLATFORM=linux/arm64 docker run -d -v ~/.aws-lambda-rie:/aws-lambda -p 9000:8080 \
--entrypoint /aws-lambda/aws-lambda-rie \
docker-image:test \
aws_lambda_ric lambda_function.LambdaFunction::Handler.process
Replace docker-image:test
with the appropriate image name and tag, and you're ready to run your containerized Lambda function.