This is a project showing a working example of creating lambda functions through docker images.
Function url: https://arbp3ozhbrrlsgsoyhk6vebmmu0ylssg.lambda-url.ap-south-1.on.aws/
Steps to execute this function:
- Clone the git repository.
git clone https://github.com/abhishekjkrsna/lambda-nodejs
- Makes changes to the lambda handler function in app.js if you want.
- Containerize the file
docker build -t <image name> .
- Run the docker image locally.
docker run -p 9000:8080 <image name>
- Test the function by running it locally.
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d ''
How to upload the image on AWS Lambda:
- Register the image in a
AWS ECR Private Repository, Public repositories will not work here. - Select your image and click create function.
- Congratulations, you have just created your first aws lambda function through docker.
