Run AWS Lambda Functions on Docker

In this tutorial we will demonstrate how to run local aws lambda functions with the help of docker and running it locally on a container. Dockerfile In our Dockerfile: FROMpublic.ecr.aws/lambda/python:3.8COPY lambda_function.py ${LAMBDA_TASK_ROOT}/COPY requirements.txt /opt/requirements.txtRUN pip install -r /opt/requirements.txt -t ${LAMBDA_TASK_ROOT}/CMD [ "lambda_function.handler" ]Lambda Function Our application code, residing in our lambda_function.py: import json import requests def handler(event, context): body = { "message": "this is a message", "input": event } response = { "statusCode": 200, "body": json....

April 23, 2021 Β· 1 min Β· Ruan Bekker