AWS Lambda container images

Jérémy Chauvet
2 min readJul 4, 2021

--

In December 2020, AWS released a new feature for Lambda service : Lambda now support containers images. As Danilo Poccia explain, “if you’ve invested in container tooling for your development workflows, it’s not easy to use the same approach to build applications using Lambda.”

Container image support is a all new way to design your architecture, pushing back service limits :

  • If classic lambda max size is only 50 Mo, lambda with containers push it to 10 Go
  • You can run your Lambda with the runtime of your choice. How sexy is a Lambda running Symfony as backend ? AWS also release a tool called Runtime Interface Emulator : to work with Lambda, your images must implement the Lambda Runtime API. You can also use AWS provided images
  • Lambda workspace is no longer read-only.

This feature changes the way to run Docker images on AWS. No need to have an EKS Fargate cluster, you can now run on-demand Docker image without thinking of a cluster !

Demonstration

I’m a Serverless framework fan, and I use it for this part. All sources are available on Github

Serverless configuration

Developpers using Serverless will be familiar with the following file :

As you can see, few things only changed with container support :

  • Lambda layers are no longer used. Dependencies must be included inside your Docker image, for example with a requirements.txt parse with Dockerfile
  • Block ECR is all new : Serverless will build and push your image on ECR (Elastic Container Registry, aka AWS Docker Hub). You can specify name and path.
  • After days of tests, I’ve not notice a significant change on cold start duration.

If you have any question, you can contact me on Twitter or LinkedIn.

Thank you for reading my article, I wish you a good day.

--

--

Jérémy Chauvet
Jérémy Chauvet

Written by Jérémy Chauvet

0 Followers

DevOps, AWS Expert & Developer (Swift / Python)

No responses yet