gofaas icon indicating copy to clipboard operation
gofaas copied to clipboard

seeding DynamoDB with data

Open johnpearson555 opened this issue 6 years ago • 4 comments

What's the best way to seed DB with data from a json file?

  • Another lambda/worker function?
  • How to best make sure the function is run one-off & only if DB is not already seeded?

johnpearson555 avatar Mar 02 '18 06:03 johnpearson555

Great question... one-off admin tasks is not obvious with Lambda in general. Particularly if you are used to interactive admin like “heroku run bash”.

The default strategy is to do everything on you computer with AWS keys and the AWS CLI.

But I suspect there is a more “app” centric pattern to develop here

nzoschke avatar Mar 02 '18 17:03 nzoschke

Ah, I see. Wish there was a better way. I'd would be great to package everything together in a single cloudformation template to get things up and running.

Would a bash script that runs conditionally in the Makefile make sense?

johnpearson555 avatar Mar 02 '18 17:03 johnpearson555

Could you use something like data pipeline to dump something in s3 > dynamo?

mwarkentin avatar Mar 02 '18 17:03 mwarkentin

@mwarkentin that's a good idea. I haven't used that before. I see there is support for it in Cloudformation templates https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-datapipeline-pipeline.html

johnpearson555 avatar Mar 02 '18 18:03 johnpearson555