Amazon DynamoDB
A fully managed, serverless NoSQL database service for fast and scalable applications on AWS.
What is Amazon DynamoDB?
Amazon DynamoDB is a fully managed, serverless, key-value and document NoSQL database service offered by AWS. It is designed to deliver single-digit millisecond performance at any scale, making it ideal for applications that require consistent, low-latency data access. DynamoDB automatically scales tables up and down to adjust for capacity and maintain performance, without the need for manual intervention.
DynamoDB is highly available and durable, with built-in security, backup and restore, and in-memory caching. It is widely used for web, mobile, gaming, IoT, and many other applications that need to handle massive volumes of data with high throughput and low latency. DynamoDB integrates seamlessly with other AWS services and supports both provisioned and on-demand capacity modes, giving you flexibility in cost and performance management.
Architecture
Key Components
Tables
The primary structure in DynamoDB, tables store collections of items. Each table requires a primary key for uniquely identifying items.
Items & Attributes
Items are individual records in a table, and attributes are the data fields within each item. Items can have flexible schemas.
Indexes
Indexes, including Global Secondary Indexes (GSI) and Local Secondary Indexes (LSI), enable efficient queries on non-primary key attributes.
Key Capabilities
Single-digit Millisecond Performance
DynamoDB delivers consistently fast responses, making it suitable for latency-sensitive applications.
Serverless & Fully Managed
No server management required. DynamoDB handles scaling, patching, and replication automatically.
Built-in Security & Backup
Supports encryption at rest, fine-grained access control, point-in-time recovery, and on-demand backups.
Common Use Cases
Implementation Example
# Python SDK Example (boto3)
import boto3
def create_table():
dynamodb = boto3.resource('dynamodb', region_name='us-west-2')
table = dynamodb.create_table(
TableName='Movies',
KeySchema=[
{'AttributeName': 'year', 'KeyType': 'HASH'}, # Partition key
{'AttributeName': 'title', 'KeyType': 'RANGE'} # Sort key
],
AttributeDefinitions=[
{'AttributeName': 'year', 'AttributeType': 'N'},
{'AttributeName': 'title', 'AttributeType': 'S'}
],
ProvisionedThroughput={
'ReadCapacityUnits': 5,
'WriteCapacityUnits': 5
}
)
print("Table status:", table.table_status)
if __name__ == "__main__":
create_table()
This Python example uses the AWS SDK for Python (boto3) to create a DynamoDB table named "Movies" with a composite primary key (year, title) and provisioned throughput. You must configure your AWS credentials before running this script.
Related Topics
Test Your Knowledge
Score 8/10 or higher to pass
You need to be logged in to take this quiz.
Login to Continue