Safeguard
Security Guides•

Can you convert a zip Lambda function to a container image?

AWS does not let you change the package type of an existing Lambda function. Moving from zip to container means a new function. A safe migration plan.

Safeguard Security Team
4 min read

Not in place. AWS states you cannot change the deployment package type of an existing function, so a zip function cannot become a container image function. You create a new function, move traffic to it, then retire the old one. Plan the cutover so the old code does not linger.

What AWS says

The container image documentation notes that you cannot change the deployment package type (.zip or container image) for an existing function, and that you must create a new function. Lambda supports two package types, and layers apply only to .zip functions.

Why teams move

Common reasons, in plain terms:

  • Dependencies too large for the 250 MB unzipped zip limit. Container images allow 10 GB uncompressed.
  • A shared base image across services, owned by a platform team.
  • Native libraries that are easier to build in a Dockerfile.

None of these are security reasons by themselves. The move trades one patching model for another, so decide with that in mind. Zip or container, which is easier to keep patched compares them.

Migration plan

  1. Inventory the old function. Runtime, layers, environment variables, role, triggers, concurrency settings and aliases.
  2. Build the image from the same source and lockfile. Use a base image you have a refresh plan for.
  3. Recreate configuration on the new function. The execution role deserves a review, not a copy. See least privilege for execution roles.
  4. Scan the image and compare findings with the old zip.
  5. Shift traffic gradually. If callers use an alias or function URL, move them in steps and watch errors.
  6. Retire the old function. Remove triggers first, then the function, then any layers only it used.

The step people skip: removal

After a migration, the old function often stays. It keeps its triggers, its role and its old dependencies. An unused function that still accepts events is an exposed, unpatched copy. Set a date when you create the new function, and put it on the ticket.

AWS also points out in its best practices that you should delete functions you no longer use, so they do not needlessly count against the package size limits.

What changes after the move

AreaZip functionContainer function
LayersSupported, up to 5Not used
Runtime updatesRuntime management modesYou rebuild on a new base
Size ceiling250 MB unzipped10 GB uncompressed
Dependency scanningScan the zipScan the image, including OS packages

Try it yourself

Open the container image scan demo to see how an image scan shows OS packages next to application packages. That is the new surface a migration adds.

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

Where Safeguard fits

Safeguard scans both source dependencies and container images, so you can compare the zip build and the image build of the same function before cutting over. Free scan: gold.safeguard.sh/scan.

Quick check

Can I switch an existing function to a container image in the console?

No. AWS says the package type cannot be changed for an existing function. Create a new one.

What happens to my layers after a move?

Container functions package their own dependencies and do not use layers.

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.