Is there a way to containerized a normal AWS Lambda function?

10/28/2020

My AWS lambda functions have input from AWS SNS (Topic subscription) and output will go to CRUD in NoSQL Database (likewise MongoDB).

So currently I have the SNS & Lambda function setup in AWS Cloud and they are working fine. However, I would like to containerize the lambda function as well as the MongoDB database and host them on AWS EKS using Docker + Kubernetes service. (So the functions will be a Docker image)

I am totally new to this container thing and I searched online though I could not found any that mentions how to containerized AWS Lambda Functions.

Is this possible? If it is what are the ways to do it? Thank you.

-- Corene
amazon-web-services
aws-lambda
containers
docker
kubernetes

2 Answers

10/28/2020

Lambda already uses Firecracker a microVM technology. So, not really sure why it's required to create a container out of Lambda.

The beauty of Lambda/Serverless is to simply write the function code and forget about the rest. If it's all about more control, then look at Knative which runs on top of K8S.

-- Praveen Sripati
Source: StackOverflow

10/28/2020

The docker environment for AWS lambda function already exist and it is lambci/lambda. So if you want to run/test your functions locally, this is the tool normally used for that:

A sandboxed local environment that replicates the live AWS Lambda environment almost identically – including installed software and libraries, file structure and permissions, environment variables, context objects and behaviors – even the user and running process are the same.

Since its open-sourced, you can also modify it if it does not suit your needs.

-- Marcin
Source: StackOverflow