docker-volume-borg-backup/localstack-part-3
Baptiste Bouchereau 45687e1dfa Use LAMBDA_REMOVE_CONTAINERS set to false instead of a custom image 2020-05-18 14:58:32 +02:00
..
docker-events-listener-build Use docker-compose to run commands 2020-02-24 19:28:01 +01:00
terraform Add files for the localstack-part-3 tutorial 2020-02-10 23:06:08 +01:00
README.md Add links to blog posts 2020-03-04 15:04:20 +01:00
docker-compose.yml Use LAMBDA_REMOVE_CONTAINERS set to false instead of a custom image 2020-05-18 14:58:32 +02:00

README.md

Deploy AWS resources in localstack with Terraform

Detailed tutorial here.

An example on how to use docker events to automatically deploy localstack resources that mock AWS services. The following instructions focus on how to deploy:

  • a dynamodb table
  • a lambda reading data and putting data to this table

Usage

Run

git clone https://github.com/Ovski4/tutorials.git
cd localstack-part-3
docker network create localstack-tutorial
docker-compose up -d
docker-compose logs -f docker-events-listener

Wait for the resources to be deployed, then invoke the lambda multiple times and scan the table to see new items and their counters being incremented:

docker-compose exec docker-events-listener aws lambda invoke --function-name counter --endpoint-url=http://localstack:4574 --payload '{"id": "test"}' output.txt
docker-compose exec docker-events-listener aws dynamodb scan --endpoint-url http://localstack:4569 --table-name table_1

docker-compose exec docker-events-listener aws lambda invoke --function-name counter --endpoint-url=http://localstack:4574 --payload '{"id": "test2"}' output.txt
docker-compose exec docker-events-listener aws dynamodb scan --endpoint-url http://localstack:4569 --table-name table_1