Day 55: Dynamic Database in AWS โ DynamoDB


๐ง What is DynamoDB?
Amazon DynamoDB is a fully managed, serverless, key-value and document NoSQL database designed for single-digit millisecond performance at any scale.
โ๏ธ Why DynamoDB for DevOps?
โ
Fully Managed โ No server provisioning or patching
โ
Highly Scalable โ Auto scaling of throughput & storage
โ
Serverless โ Integrates easily with AWS Lambda, API Gateway, etc.
โ
Event-Driven โ Triggers via DynamoDB Streams for CI/CD workflows
โ
Secure โ Encryption, IAM policies, fine-grained access control
๐งฑ DynamoDB Core Concepts
Term | Description |
Table | Collection of data (like a collection in MongoDB) |
Item | Equivalent of a row in SQL |
Attribute | Equivalent of a column in SQL |
Primary Key | Uniquely identifies each item (can be a partition key or composite key) |
Throughput | Read/Write capacity units |
Global Tables | Replicate tables across AWS regions |
๐ ๏ธ How to Create a DynamoDB Table (via AWS CLI)
aws dynamodb create-table \
--table-name DevOpsProjects \
--attribute-definitions AttributeName=ProjectID,AttributeType=S \
--key-schema AttributeName=ProjectID,KeyType=HASH \
--provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
๐ This creates a table DevOpsProjects
with ProjectID
as the partition key.
๐ฅ Insert Data into DynamoDB
aws dynamodb put-item \
--table-name DevOpsProjects \
--item '{
"ProjectID": {"S": "day55"},
"Name": {"S": "DynamoDB Setup"},
"Status": {"S": "Completed"}
}'
๐ค Read Data
aws dynamodb get-item \
--table-name DevOpsProjects \
--key '{"ProjectID": {"S": "day55"}}'
๐ Use Case in DevOps
Store deployment metadata for builds
Log automation job results
Track application configurations
Session storage for stateless apps
Manage feature flags or user preferences
๐งช Optional: Enable Streams
DynamoDB Streams allow you to trigger AWS Lambda functions on data changes:
aws dynamodb update-table \
--table-name DevOpsProjects \
--stream-specification StreamEnabled=true,StreamViewType=NEW_AND_OLD_IMAGES
๐ Security with IAM
You can create fine-grained access policies to control:
Table read/write
Specific items by partition key
Conditional access
๐ฆ Summary
Feature | Available in DynamoDB |
Serverless | โ Yes |
Auto Scaling | โ Yes |
Backup & Restore | โ Yes |
Real-Time Triggers | โ Yes (via Streams) |
Global Tables | โ Yes |
JSON-like Structure | โ Yes |
Subscribe to my newsletter
Read articles from Shaharyar Shakir directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
