Load Data into DynamoDB¶
| Category | Cloud & AWS Data & Serverless |
| Status | โ Completed |
| Repo | nextwork-load-data-into-dynamodb |
| Original NextWork guide | nextwork.ai |
Learning project
Practice work following a NextWork guide, separate from my production projects.
๐ NextWork learning project. This is a practice project I built while working through NextWork's Load Data into DynamoDB guide. It is part of my Learning portfolio and is fully separate from my production projects.
Category: Learning โบ Cloud & AWS Data & Serverless
Status: โ
Completed
Overview¶
This project introduces non-relational data with Amazon DynamoDB. You create tables keyed by partition (and sort) keys, bulk-load JSON with batch-write-item from CloudShell, and edit items. The flexible schema means items in the same table can have different attributes.
Summary¶
Created the 4 DynamoDB tables (on-demand) on real AWS, loaded them with the guide's batch-write-item commands, and read items back with get-item, scan counts and a partition-key query. Everything was torn down afterwards.
The checks behind this are in docs/verification.txt.
Skills & tools¶
AWS, Terraform, Infrastructure as Code, moto (AWS mock), Amazon DynamoDB, NoSQL data modeling, Partition & sort keys, batch-write-item, AWS CLI, boto3, Python
What I built¶
main.tf: ContentCatalog (Id), Forum (Name), Post (ForumName+Subject), and Comment (Id+CommentDateTime, plus a PostedBy GSI). On-demand billing.data/*.json: sample items in DynamoDB's batch-write format.load_data.py: the boto3 version of the CloudShellbatch-write-itemloop.cli-commands.shhas the original AWS CLI commands.checks.py: confirms load counts, scans, and an item edit.
How to run¶
pip install -r requirements-dev.txt # moto (local AWS mock) + boto3
./local-test.sh # terraform apply against the mock, run checks.py, then destroy
# Real AWS (costs money; use your own IAM user/profile):
terraform init && terraform apply # mock_endpoint defaults to "" = real AWS
terraform destroy # clean up when done
Verification¶
I ran the verification command on 2026-12-02. The full output is in docs/verification.txt.
PATH=/workspace/nextwork-portfolio/.venv/bin:$PATH TF_PLUGIN_CACHE_DIR=/workspace/nextwork-portfolio/tf-plugin-cache ./local-test.sh
Real AWS deployment (2026-12-02)¶
I deployed this project to a real, dedicated AWS learning account (us-east-1, kept separate from everything else I run), checked it, captured the output, and tore it all down right after. Every resource carried the tag Project=nextwork-load-data-into-dynamodb so I could prove nothing was left behind.
How I ran it: ./real-aws-run.sh (in this repo) does terraform init/apply with my AWS profile, runs checks.py against the real account, runs real-extra.sh for the live tests, and then always runs terraform destroy, even if a step fails.
Evidence (excerpt; the full, sanitized transcript is in docs/aws-real-run.txt, with the account ID redacted):
$ python3 checks.py (against the real account)
ALL 6 CHECKS PASSED
$ ./real-extra.sh
{
"UnprocessedItems": {}
}
{
"UnprocessedItems": {}
}
{
"UnprocessedItems": {}
}
{
"UnprocessedItems": {}
}
{
"Item": {
"Title": {
"S": "Build a Virtual Private Cloud"
"Price": {
"N": "0"
"ContentType": {
"S": "Project"
"Services": {
"SS": [
"Amazon VPC"
"Published": {
"BOOL": true
"Id": {
"N": "1"
"Difficulty": {
"S": "Easy peasy"
}
--- item counts per table
ContentCatalog: 5 items
Forum: 2 items
Post: 3 items
Comment: 3 items
--- query: all comments on one post (partition-key query)
2026-11-20T10:05:00Z Query when you know the partition key. User B
2026-11-20T11:00:00Z Scan reads the whole table, avoid it. User C
Teardown¶
Resources were up from 20:05 to 20:06 CST on 2026-12-02, then destroyed and verified gone:
=== TEARDOWN 2026-12-02 20:06 CST ===
$ terraform destroy -auto-approve -input=false -no-color -var project_tag=nextwork-load-data-into-dynamodb
Destroy complete! Resources: 4 destroyed.
$ terraform state list (should be empty)
$ aws resourcegroupstaggingapi get-resources --tag-filters Key=Project,Values=nextwork-load-data-into-dynamodb
$ live EC2 instances / volumes / VPCs tagged Project=nextwork-load-data-into-dynamodb (should be empty)
=== teardown verified 20:06 CST ===
Cost¶
Estimated cost of the real run: $0.00 (on-demand tables and a few dozen requests, inside DynamoDB's always-free tier). The account has a $50/month budget with email alerts at $5, $20 and $40, and the whole AWS series is logged in a private spend ledger.
Original project: https://nextwork.ai/projects/8bd82466-f5ee-569e-9125-2c4c6ce7a07f ยท Part of my NextWork Learning portfolio (hub).
Verification output¶
From docs/verification.txt:
$ PATH=/workspace/nextwork-portfolio/.venv/bin:$PATH TF_PLUGIN_CACHE_DIR=/workspace/nextwork-portfolio/tf-plugin-cache ./local-test.sh
Success! The configuration is valid.
Apply complete! Resources: 4 added, 0 changed, 0 destroyed.
tables = [
"ContentCatalog",
"Forum",
"Post",
"Comment",
]
PASS: batch-write loaded all 4 tables ({'Comment': 3, 'ContentCatalog': 5, 'Forum': 2, 'Post': 3})
PASS: Comment scan returns 3 items
PASS: ContentCatalog scan returns 5 items
PASS: Forum scan returns 2 items
PASS: Post scan returns 3 items
PASS: item edit persisted (flexible schema: new attribute added)
ALL 6 CHECKS PASSED
[exit code 0]