Safeguard
Developer Tools•

Lambda zip or container image: which is easier to keep patched?

Zip packages get automatic runtime patches. Container images give version consistency but need rebuilds. A comparison of the patch work each one creates.

Safeguard Security Team
4 min read

Neither is easier in every case. A .zip function on a managed runtime receives runtime patches automatically from Lambda, while you update dependencies. A container image gives identical versions everywhere but you must rebuild from the latest base image and redeploy. Choose by who you want to do the patching.

What AWS says each model asks of you

From the shared responsibility table in the Lambda documentation:

ModelLambda's jobYour job
.zip on a managed runtimePublish runtime updates and apply them automatically by defaultUpdate your function code and dependencies
Container imagePublish updated base imagesUpdate dependencies, and regularly rebuild and redeploy from the latest base image

In both models, dependencies are yours. The difference is whether the operating system and language runtime update by themselves.

Where each model shines

.zip with a managed runtime

  • Runtime security updates roll out automatically, so idle functions still get them in the second phase of the rollout.
  • Deprecation emails, Health Dashboard notices and Trusted Advisor checks tell you when a runtime is ending.
  • Layers let you share dependencies, up to five per function.

Container image

  • You control the image, which AWS recommends if you need guaranteed runtime version consistency across environments, because managed runtime versions roll out gradually across regions.
  • The code package can be up to 10 GB uncompressed, versus 250 MB unzipped for a .zip.
  • The image is a clear, scannable artifact with its own layers.

Where each one bites

  • A .zip can drift between regions by a runtime version if you deploy at different times.
  • A container image that nobody rebuilds goes stale. AWS notes that deprecation notifications are not available for container image functions, so you must watch base image dates yourself.
  • Layers are not available for container image functions. AWS says to package the runtime and all dependencies in the image.
  • Switching later is a rebuild: you cannot change the package type of an existing function, so you create a new function.

A decision guide

  1. Small functions, frequent deploys, standard runtime: .zip on a managed runtime.
  2. Large dependencies, custom system libraries or strict version consistency: container image.
  3. Many teams sharing a library: a layer for .zip, a shared base image for containers.
  4. A team without a rebuild schedule: .zip, because Lambda patches the runtime for you.
  5. A team with an image pipeline and scanning: container image works well.

If you pick containers, schedule the rebuilds

Set a regular rebuild that pulls the latest base image even when your code is unchanged, scan the result, and redeploy through an alias. Track base image end of support dates alongside your own releases.

Try it yourself

Click through it at your own pace, or open it full screen.

Look at the findings by layer. A container based function gives you this view, and a rebuild clears base layer findings.

Quick check

Can I convert a zip function to a container image?

Not in place. AWS says you cannot change the package type of an existing function, so you create a new function.

Does Lambda rebuild my container image?

No. For container image functions you are responsible for rebuilding from the latest base image and redeploying.

Safeguard's container image scanning and SBOM generation help you see what each build contains. Try a free scan at gold.safeguard.sh/scan.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.