Skip to content

maxhoheiser/localstack-example-lambda-dynamodb

Repository files navigation

LocalStack example using AWS Lambda and DynamoDB

Key Value
Services Lambda, DynamoDB, Event Bridge
Integrations AWS SDK, AWS CLI, GitHub actions, pytest
Categories Serverless, DynamoDB, LocalStack developer endpoints, Python
Level Intermediate

Description

This app queries DockerHub to get the number of pulls and stars for a given image. This information is stored in a DynamoDB table, indexed by the query time. The app is deployed as an AWS Lambda function and uses the AWS SDK to interact with DynamoDB. A Event Bridge is used to trigger the Lambda function each minute. The app is tested using pytest and awslocal using the localstack docker container.

Getting Started

Dependencies

LocalStack cli and docker container

Installing

create a virtual environment and install the requirements

pip install -r requirements-dev.txt
pre-commit install
commit-linter

Run the program

  1. Start localstack

    localstack start
  2. Deploy the lambda function and provision the DynamoDB table

    sh bin/deploy.sh

Testing

  • run unit tests

    make test
  • run integration tests:

    make integration-test
  • GitHub actions CI tests .github/workflows/test-integration-localstack.yaml

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published