DEV Community

Cover image for Lambda container approach in AWS

Posted on

Lambda container approach in AWS

Zip vs Container Approach

There are two ways to use Lambda functions in AWS. One is to provide the deployable artifact in the form of a zip file. You then have a variety of runtimes you can choose from:

The other approach is the Lambda container approach. IMO, the container approach to Lambda management has two main advantages over the zip approach.

Runtime selection

With the zip approach, you have to rely on Amazon supporting the desired runtime. For example, if your code depends on Python3.10, you better hope that Amazon supports that. In a container approach however, the runtime is something you have full control over. Just make sure either your base image supports the runtime or you install the runtime as part of one of your RUN statements.

Building dependencies

Non-native packages such as pandas, lxml, etc have to be built in the target environment for the compiled binaries to work. For example, if you build pandas on Mac, then the compiled binaries will work on Mac - not on Amazon Linux 2 which is what Lambda runs on.

With containers, you no longer have to worry about building for a target OS, as you're able to encapsulate OS details in an image. Put simply, the image you build locally will just work in Lambda. How easy is that!

Top comments (0)