Seeding Data¶
The seed-dynamodb.sh script seeds both pet adoption and petfood DynamoDB tables with sample data. It supports interactive and non-interactive modes.
Usage¶
Interactive Mode¶
Presents a menu:
- Seed both pet adoption and petfood tables
- Seed pet adoption table only
- Seed petfood table only
- Select specific table manually
Non-Interactive Mode¶
# Seed all tables
./src/cdk/scripts/seed-dynamodb.sh all
# Seed by type
./src/cdk/scripts/seed-dynamodb.sh pets
./src/cdk/scripts/seed-dynamodb.sh petfood
# Seed specific table
./src/cdk/scripts/seed-dynamodb.sh pets MyPetAdoptionTable
Prerequisites¶
- AWS CLI configured with valid credentials
- DynamoDB table read/write access
jqinstalled- CDK resources deployed first
Data Structure¶
Pet Adoption Data¶
{
"petid": "P001",
"petname": "Buddy",
"petage": "2",
"pettype": "dog",
"breed": "Golden Retriever"
}
Petfood Data¶
{
"id": "F001",
"name": "Premium Dog Food - Adult",
"brand": "PetNutrition Pro",
"price": "24.99",
"pet_type": "dog",
"food_type": "dry",
"ingredients": ["Chicken", "Rice", "Vegetables"],
"nutritional_info": {
"Protein": "28%",
"Fat": "15%"
}
}
Features¶
- Automatic table discovery via pattern matching
- Automatic DynamoDB format conversion (strings, string sets, maps)
- Validation of AWS credentials and seed files
- Progress reporting during seeding