Skip to content

Provision DynamoDB local using the same infra-as-code of production

Currently we are creating the tables and appending the data to dynamodb local with awscli:

https://gitlab.com/fluidattacks/integrates/-/blob/master/deploy/containers/common/vars/provision_local_db.sh#L3

this is ugly, and duplicated, since we have the infra already defined here:

https://gitlab.com/fluidattacks/integrates/-/blob/master/deploy/terraform-resources/dynamodb/dynamo-tables.tf

wouldn't it be awesome to reuse that infra-as-code ?

well, it's possible:

https://www.terraform.io/docs/providers/aws/guides/custom-service-endpoints.html#getting-started-with-custom-endpoints

and we can also manage the data as a terraform resource, elegantly (we can load the JSON from a file instead of hard-coding it there as in the example) !!!

https://www.terraform.io/docs/providers/aws/r/dynamodb_table_item.html

example: https://github.com/kamadorueda/tracers/blob/latest/build/launch-db/run.sh

Problem to solve

Intended users

User experience goal

Proposal

Permissions and Security

What does success look like, and how can we measure that?

Links / references