DEV Community

Wakeup Flower
Wakeup Flower

Posted on

Lambda can pull image from ECR

1 — What “Lambda functions as container images” actually means

It means:

  • Instead of uploading a .zip package, you build a container image containing your code, dependencies, and runtime.
  • You push that image to Amazon Elastic Container Registry (ECR).
  • Lambda will pull the image from ECR when it runs.

Lambda does not build or store the container image for you — you must create and maintain it yourself.


2 — Key constraints

Even with container images:

  • You still cannot run arbitrary container orchestration (like ECS or EKS).
  • Lambda runs containers in a serverless environment with its own constraints:

    • Max image size: 10 GB
    • Max memory: 10 GB
    • Limited execution time: 15 minutes per invocation
  • No access to underlying OS for persistent storage — Lambda containers are ephemeral.


3 — Why ECR is necessary

ECR acts as:

  • The repository for Lambda container images.
  • A secure, scalable storage for your images so Lambda can pull them when needed.
  • The only AWS-supported registry for Lambda container functions.

Without ECR, Lambda cannot run container images.


4 — Lambda vs. Containers in ECS/EKS

Feature Lambda (container images) ECS/EKS
Orchestration No Yes
Persistent state No Possible
Runtime limit 15 minutes None
Scaling Automatic per invocation Configurable
Packaging .zip or container image Container image
Requires ECR? Yes No (can use other registries)

5 — Real takeaway

The phrase "Lambda functions as container images" is true, but it doesn’t mean Lambda is a container platform.
It’s just an alternative packaging method for Lambda functions.
The image must be already built and stored in ECR before Lambda can use it.

Lambda still:

  • Runs in a managed serverless environment.
  • Doesn’t give you control over container orchestration.
  • Still has execution limits.

Top comments (0)