https://github.com/danieldacosta/offline-lambda
Testing an AWS Lambda offline
https://github.com/danieldacosta/offline-lambda
aws-lambda-offline docker lambda
Last synced: about 2 months ago
JSON representation
Testing an AWS Lambda offline
- Host: GitHub
- URL: https://github.com/danieldacosta/offline-lambda
- Owner: DanielDaCosta
- Created: 2020-07-07T01:54:53.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-23T17:07:00.000Z (over 5 years ago)
- Last Synced: 2025-01-11T01:10:38.165Z (over 1 year ago)
- Topics: aws-lambda-offline, docker, lambda
- Language: Python
- Homepage:
- Size: 8.79 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# offline-lambda
Testing an AWS Lambda offline.
Repo for testing a lambda function locally.
# Details
- event.json: file that contains the lambda *event*
- lambda/: lambda code
# Usage
Command for invoking lambda.Starting the Docker container corresponds to an AWS Lambda cold start.
```
docker-compose run lambda lambda.handler.lambda_handler "$(cat event.json)"
```
Command for keeping the container of our Lambda function running: you can make several consecutive calls quickly without waiting for the “cold start” times.
```
docker-compose run -e DOCKER_LAMBDA_STAY_OPEN=1 lambda lambda.handler.lambda_handler "$(cat event.json)"
```
# References & Acknowledgments
Special Thanks for Vittorio Nardone for the medium post:
- https://levelup.gitconnected.com/aws-lambda-offline-development-with-docker-6a8cf8b186e7
- https://hub.docker.com/r/lambci/lambda/