Using container images built on an M2 Macbook with Lambda functions requires a bit of ingenuity.
When trying to build container images on an M2 Macbook and deploy them to Lambda functions, you may encounter the following errors.
The image manifest or layer media type for the source image 123456789012.dkr.ecr.us-east-1.amazonaws.com/test-lambda@sha256:1233456789012 is not supported.
When this error occurs, try running the build with the "--provenance=false" option during the build process.
# To run Lambda functions on x86_64, execute the following command
docker build --platform linux/amd64 --provenance=false -t test-lambda .
# To run Lambda functions on arm64, execute the following command
docker build --platform=linux/arm64 --provenance=false -t test-lambda .
The cause of this error is that Lambda does not support multi-architecture container images.
As of May 2025, Lambda does not support multi-architecture container images.
https://docs.aws.amazon.com/lambda/latest/dg/images-create.html
Lambda provides multi-architecture base images. However, the image you build for your function must target only one of the architectures. Lambda does not support functions that use multi-architecture container images.
Other workarounds include building container images using GitHub Actions or building container images using CloudShell.
https://docs.aws.amazon.com/cloudshell/latest/userguide/tutorial-docker-cli.html