aws-cdk-dynamodb-seeder
A simple CDK JSON seeder for DynamoDB
Why this package
Glad you asked!
Using AWS CDK for automating infratructure deployments is an amazing way of integrating the development and operations into one process and one codebase.
However, building dev or test environments that come pre-populated with data can be tricky, especially when using Amazon DynamoDB.
How do I use it
new Seeder(stack, 'MySeeder', {
table: new Table(stack, 'MyTable', {
tableName: 'MyTable',
partitionKey: { name: 'Id', type: AttributeType.STRING },
}),
tableName: "TestTable",
json: require("./my-seed-data.json")
});
Importing seed data
Seed data is imported via a JSON file and can either be a single object or an array of objects.
Just remember that the objects must match your table's key definitions.