Docker on Lambda or Lambda on Docker?

Andy Jassy announced AWS Lambda Container Support on December 1st, 2020.

AWS Lambda now supports container images as a packaging format

You can now package and deploy AWS Lambda functions as a container image of up to 10 GB. Customers can start building functions as container images by using either a set of AWS base images for Lambda, or by using one of their preferred community or enterprise images.

Creating Lambda container images

You can package your Lambda function code and dependencies as a container image, using tools such as the Docker CLI. You can then upload the image to your container registry hosted on Amazon Elastic Container Registry (Amazon ECR). Note that you must create the Lambda function from the same account as the container registry in Amazon ECR.

AWS provides a set of open-source base images that you can use to create your container image. These base images include a runtime interface client to manage the interaction between Lambda and your function code.

Not sure yet how this differs from Fargate or whether this even makes sense at all, but a lot of people want to deploy Redwood with a Docker container without losing the simplicity of deploying with Lambda.

Fargate is a bit like running Lambda on Docker, whereas now we are able to run Docker on Lambda. For all we know running Docker on Lambda could just as easily be the worst of both worlds instead of the best, but seems worth investigating to find out.

The Serverless Application Model is the first AWS metaframework to offer support.

In this blog post, I walk through building a simple serverless application that uses Lambda functions packaged as container images with AWS SAM. I demonstrate creating a new application and highlight changes to the AWS SAM template specific to container image support.

I then cover building the image locally for debugging in addition to eventual deployment. Finally, I show using AWS SAM to handle packaging and deploying Lambda functions from a developer’s machine or a CI/CD pipeline.