aws-cdk-dynamodb-seeder

A simple CDK JSON seeder for DynamoDB


Keywords
amazon-dynamodb, aws, aws-cdk, cdk-seeder, dynamodb, iac, seeder
License
Apache-2.0
Install
pip install aws-cdk-dynamodb-seeder==1.27.0

Documentation

aws-cdk-dynamodb-seeder

Node.js CI codecov npm version npm

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

Install using your favourite package manager:

yarn add aws-cdk-dynamodb-seeder

Example usage

import { Seeder } from 'aws-cdk-dynamodb-seeder';
...
const myTable = new Table(stack, "MyTable", {
    tableName: "MyTable",
    partitionKey: { name: "Id", type: AttributeType.STRING },
});
...
new Seeder(stack, "MySeeder", {
    table: myTable,
    tableName: "MyTable",
    setup: require("./my-seed-data.json")
});

Importing seed data

Seed data is imported/deleted via an arrays of objects. Just remember that the objects must match your table's key definitions.