This project contains isolated examples of AWS Lambda Services as well this provide a stack example.
Diagrams with application usage of this architecture.
More details here.
Example of the architecture running on AWS Cloud.
Example of the architecture running with docker.
Example of OpenApi documentation.
Route list:
GET / - Root
GET /docs - Swagger docs
GET /alive - Health Check
GET /v1/event/<event_type> - Event List
POST /v1/event/<event_type> - Create Event
- Python >=3.6
- docker
- docker-compose
- python-dotenv
- jsonformatter
- requests
- pytz
- redis
- pyyaml
- apispec
- marshmallow
- Flask
- Docker-compose
- Localstack
- SQS Integration
- Flask
- MySQL
- Redis
Example of the workflow to create the environment.
You can find light examples:
You can find complex examples:
Collection of common application modules, light modules.
Collection of specific application modules, heavy modules that can be converted to layers if necessary.
Collection of specific test application modules.
Documentation: https://docs.aws.amazon.com/pt_br/cli/latest/userguide/install-cliv2.html
Execute the follow command:
apt install python38-env
apt install awscli
apt install zip
app install pip
Execute the follow command:
aws configure
Execute the follow command:
apt install python38-env
To execute the creation of the Docker network, execute the follow command:
./scripts/docker/create-network.sh
To create the venv
and install the modules execute:
./scripts/venv.sh
To execute the build:
./scripts/runenv.sh --build
Execute the follow command:
./scripts/runenv.sh
Execute the follow command:
./scripts/fixenv.sh
Bellow we describe the usage of the automation scripts. These kebab case scripts helps the developer in general tasks.
Kebab case script to help the developer in general tasks.
Script | Description | Context |
---|---|---|
autopep8.sh | Execute the code-lint for pep8 | Codelint |
boot.sh | Boot the application during de container execution | Local boot |
boot-db.sh | Boot the data for the database | Local boot |
boot-queues.sh | Boot the queues of the application in the localstack | Local boot |
boot-validate-connection.sh | Check if localstack is ready to connect | Local boot |
clean-env.sh | Clean the ./vendor folder | Local install |
fixenv.sh | In some cases where the network are deleted, you can fix the container references | Local install |
install.sh | Script to install the dependencies | Local install |
install-local.sh | Script to install the dependencies in the ./vendor folder | Local install |
openapi.sh | Script to generate the openapi.yaml | CI/CD pipeline |
preenv.sh | Script to execute the pre build commands | Local boot |
pylint.sh | Script to execute the pylint analysis | Local development |
runenv.sh | Script to start the project locally | Local development |
testenv.sh | Script to run the environment with focus in the component tests | Local development |
venv.sh | Script to install the dependencies in the venv folder | Local install |
venv-exec.sh | Script to execute scripts to install content inside the venv | Local install |
zip.sh | Generate a zip file with the application content | Other |
Helper scripts to do tasks for docker context;
Helper scripts to run flask locally, not inside a docker container;
Helper scripts to run commands over Localstack resources like S3, SQS, Lambda, etc;
Helper scripts to execute migrations;
Helper scripts to generate openapi schemas and specifications;
Helper scripts to execute tests and generate reports;
See the project samples in this folder here.
List functions:
./scripts/localstack/lambda/list-function.sh
Invoke lambda_api:
./scripts/localstack/lambda/invoke-api-function.sh lambda_api
Invoke lambda_sqs:
./scripts/localstack/lambda/invoke-sqs-function.sh lambda_sqs
See the license: LICENSE.md.
- Anderson de Oliveira Contreira andersoncontreira