Member-only story
Terraform — Deploying Docker Images on AWS Lambda Function

Serverless computing has revolutionized the way we develop and deploy applications. AWS Lambda, one of the leading serverless computing platforms, allows you to run code without provisioning or managing servers. While AWS Lambda supports several programming languages, sometimes you might want to use a custom runtime or even deploy applications packaged as Docker containers. In this blog post, we’ll explore how to deploy Docker images on AWS Lambda functions using Terraform.
Prerequisites
Before you begin, make sure you have the following prerequisites:
- An AWS account with the necessary permissions.
- Terraform should be installed on the machine. If Terraform does not exist you can download and install it from here.
- Docker: Install Docker on your local machine.
Write Application Code/Docker File
Now, let’s create a sample Application with a Docker image file
Create
application
folder on the root of your project directory, for sample application code.
- Create a file named
Dockerfile
with the following code:
FROM public.ecr.aws/lambda/nodejs:16
# Copy function code
COPY app.js…