2020-02-10 22:06:08 +00:00
Deploy AWS resources in localstack with Terraform
=================================================
2020-03-04 14:04:10 +00:00
[Detailed tutorial here. ](https://baptiste.bouchereau.pro/tutorial/automatic-provisioning-of-localstack/ )
2020-02-10 22:06:08 +00:00
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
```bash
2020-02-10 22:10:42 +00:00
git clone https://github.com/Ovski4/tutorials.git
cd localstack-part-3
2020-02-10 22:06:08 +00:00
docker network create localstack-tutorial
docker-compose up -d
2020-02-10 22:10:42 +00:00
docker-compose logs -f docker-events-listener
2020-02-10 22:06:08 +00:00
```
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:
```bash
2020-02-24 18:28:01 +00:00
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
2020-02-10 22:06:08 +00:00
2020-02-24 18:28:01 +00:00
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
2020-02-10 22:06:08 +00:00
```