Giter VIP home page Giter VIP logo

aws-lambda-db's Introduction

AWS Lambda DB

local tests coverage flake8 mypy pycodestyle pydocstyle pylint pyright bandit

Creates an AWS Lambda function which receives data from a AWS SQS queue and stores it in an SQL database.

This project uses Pydantic, SQLAlchemy, SQLModel, psycopg2. AWS is configured with the CLI and CloudFormation/SAM template.

See also

Readme Contents

Testing

Tests and linting checks run via GitHub actions after each push. Tests can be run locally (no interaction with AWS), or with AWS (cloud tests).

Local tests

  1. Optional: provide a PostgreSQL database server for testing, else the tests will use SQLite only.
    • The following environment variables must be set before running the tests: TEST_DB_PORT, TEST_DB_USER, TEST_DB_NAME, TEST_DB_HOST, TEST_DB_PASSWORD, TEST_DB_DIALECT_DRIVER
    • The database named TEST_DB_NAME must already exist.
    • Only TEST_DB_DIALECT_DRIVER='postgresql+psycopg2' is supported.
  2. Run all tests and linting with test.sh

Cloud tests

TODO

Deployment

  1. Provide values for the environment variables listed in config.sh
  2. Execute script setup.sh. This will create the resources and start the lambda. A file "id.txt" is created which stores a random number used for uniqueness.
  3. Change log level using: ./create.sh loglevel <log level string e.g. DEBUG>
  4. Stop the lambda and delete all resources using: ./create.sh clean

Development

After deploying the stack, the lambda code and the packaged Python library dependencies can be updated independently, and rapidly, using the following commands:

  • Lambda function update: ./create.sh update_function
  • Python packages update: ./create.sh update_layer

aws-lambda-db's People

Contributors

e-mit avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.