Search code examples
dockeraws-lambdaamazon-ecramazon-ecr-public

Using a public ECR image for lambda function


Is it currently possible to use a public ECR image to deploy a lambda? I have tried to create a public ECR image but I see an error in the web interface. I'm seeing an error: "This is an invalid Elastic Container Registry Image URI"

Dockerfile:


FROM public.ecr.aws/lambda/nodejs:12
# Alternatively, you can pull the base image from Docker Hub: amazon/aws-lambda-nodejs:12

COPY app.js package.json /var/task/

# Install NPM dependencies for function
RUN npm install

# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile)
CMD [ "app.handler" ]

enter image description here


Solution

  • It's not possible to do this today, but that could change in the future. For now, your function must use an ECR private repository in the same region and account as the function.