The purpose of this project is to demonstrate (in a manner close to production-level code) how to deploy a simple AWS Lambda and associated infrastructure to an AWS account.
Features of the project:
- A simple lambda handler (
src/file_reader/reader.py
) that accepts an S3 event, checks if it refers to atxt
file and then logs the contents of the file. - The code features trapping of specific errors (including a custom error) and handles unexpected
RuntimeErrors
. - The code is tested (
test/test_file_reader/test_lambda.py
) using themoto
library to mock AWS artefacts. Test coverage for executed code is 86%. - The project build is via a
Makefile
which allowsbandit
andsafety
checks for security vulnerabilities, andflake8
checks for PEP8 compliance.
- Python
- Make
- AWS CLI tool (version 2) - installation instructions here: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
- Fork and clone this project.
- In the terminal, navigate to the root directory of the project, and run:
make requirements
- Then run:
make dev-setup make run-checks