3 Ways to Overcome AWS Lambda Deployment Size Limit — Part 2

Bk Lim
Geek Culture
Published in
4 min readMay 17, 2021

--

AWS Lambda with container image

In the previous article, I shared 2 approaches on how to overcome the AWS Lambda deployment size limit, i.e. using S3 or AWS EFS to store large data files/dependencies. In this article, I will share how we can use Lambda with container image to achieve the same.

A bit of context, AWS announced at the end of 2020 that AWS Lambda will now provide container image support. With that, a user can now deploy Lambda functions up to 10GB in size, vastly increased from the existing 250MB limit. AWS provides base images that we can use for all the supported Lambda runtimes (Python, Nodejs, etc.). Otherwise, you can create a custom image by implementing the Lambda Runtime API.

Implementation

The implementation for my example is fairly straightforward. In the case of using container image, we don’t need to make any modification to the original handler function and we don’t need to move the data file away from our repository. My final directory structure looks something like below:

Directory Structure

Steps:

  1. Create Dockerfile and build the docker image
  2. Create an ECR

--

--

Bk Lim
Geek Culture

Software Engineer @ Meta. GCP PCA. Likes to write about tech, architecture, automation, JS and Python. :)