Overview

AWS DynamoDB is a proprietary, fully managed NoSQL database service offered by Amazon Web Services. Launched in 2012, it is designed to deliver consistent, single-digit-millisecond latency at any scale, making it an option for applications requiring high performance and availability, such as serverless applications, web applications, mobile backends, gaming platforms, and ad technology solutions AWS DynamoDB homepage. DynamoDB automatically scales to accommodate increases in traffic without requiring manual intervention, distributing data and traffic across multiple servers.

DynamoDB supports both key-value and document data models. The key-value model stores data as a collection of items, each with a primary key and one or more attributes. The document model allows for more complex, nested structures, similar to JSON documents. This flexibility allows developers to model a range of data types without strict schema enforcement, which can accelerate development cycles. However, effective data modeling in NoSQL databases like DynamoDB often requires a different approach than traditional relational databases, focusing on access patterns to optimize performance and cost Martin Fowler on NoSQL patterns.

Integration with the broader AWS ecosystem is a core aspect of DynamoDB. It works with services such as AWS Lambda for serverless function triggers, Amazon S3 for data archival, Amazon Kinesis for real-time data streaming, and AWS Identity and Access Management (IAM) for granular security controls DynamoDB Developer Guide. This integration can simplify the development and deployment of cloud-native applications on AWS. Developers interact with DynamoDB primarily through the AWS SDKs, which are available for multiple programming languages, providing a consistent API experience within the AWS environment.

The service offers features such as global tables for multi-region, multi-active replication, DynamoDB Streams for capturing item-level changes, and DynamoDB Accelerator (DAX) for in-memory caching. These capabilities aim to address requirements for global applications, real-time analytics, and performance optimization. DynamoDB also provides built-in backup and restore functionality, point-in-time recovery, and encryption at rest to address data durability and security requirements.

Key features

  • Managed Service: AWS manages infrastructure provisioning, patching, and backups, reducing operational overhead AWS DynamoDB overview.
  • Scalability: Automatically scales throughput and storage to meet demand, supporting millions of requests per second and petabytes of data.
  • High Performance: Delivers consistent single-digit-millisecond latency for read and write operations.
  • Flexible Data Model: Supports key-value and document data models, allowing for flexible schema design.
  • Global Tables: Provides multi-region, multi-active replication for globally distributed applications, offering high availability and low-latency access to data for users worldwide DynamoDB Global Tables documentation.
  • DynamoDB Streams: Captures item-level modifications in DynamoDB tables as a time-ordered sequence of events, enabling real-time analytics, materialized views, and cross-region replication DynamoDB Streams developer guide.
  • DynamoDB Accelerator (DAX): An in-memory cache for DynamoDB that delivers microsecond response times for read-heavy workloads DynamoDB Accelerator (DAX) information.
  • On-Demand and Provisioned Capacity: Offers two capacity modes to optimize cost and performance based on application access patterns.
  • Backup and Restore: Provides full backups and point-in-time recovery for continuous data protection.
  • Security and Compliance: Supports encryption at rest, integrates with AWS IAM, and adheres to compliance standards including SOC 1, SOC 2 Type II, SOC 3, PCI DSS Level 1, ISO 27001, ISO 27017, ISO 27018, HIPAA eligibility, and GDPR DynamoDB compliance details.

Pricing

DynamoDB's pricing model is pay-as-you-go, based on consumption of read and write capacity units, storage, and optional features. Customers can choose between two capacity modes: On-Demand or Provisioned.

Component Pricing Model Details (as of May 2026)
Read/Write Capacity On-Demand Capacity Mode Pay per request for data reads and writes. Suitable for unpredictable workloads.
Read/Write Capacity Provisioned Capacity Mode Specify the number of reads and writes per second your application requires. Suitable for predictable workloads.
Data Storage Per GB per month Charges apply for the amount of data stored in your DynamoDB tables.
Backup and Restore Per GB per month (storage) + restore fee Charges for backup storage and data transfer during restore operations.
DynamoDB Streams Per million read request units Charges for data read from DynamoDB Streams.
Global Tables Replication write unit (RWU) + inter-region data transfer Additional charges for data replication across regions and data transfer.
DynamoDB Accelerator (DAX) Per node-hour Charges based on the instance type and duration DAX cluster runs.

A free tier is available, offering 25 GB of storage, 25 units of read capacity, and 25 units of write capacity per month. This free tier is sufficient to handle up to 200 million requests per month AWS DynamoDB pricing page.

Common integrations

Alternatives

  • MongoDB Atlas: A fully managed cloud database service for MongoDB, supporting document data models with flexible schemas and offering global distribution.
  • Cassandra (Apache Cassandra): An open-source, distributed NoSQL database known for its high availability and linear scalability, often deployed on-premises or on IaaS.
  • Google Cloud Firestore: A serverless document database for mobile, web, and IoT applications, offering real-time synchronization and offline support.
  • Azure Cosmos DB: Microsoft's globally distributed, multi-model database service, supporting various APIs including SQL, MongoDB, Cassandra, and Gremlin.
  • ScyllaDB: An open-source NoSQL database compatible with Apache Cassandra and Amazon DynamoDB APIs, designed for low-latency and high-throughput workloads.

Getting started

The following Python example demonstrates how to create a DynamoDB table, add an item, and retrieve it using the Boto3 AWS SDK. This code assumes you have the AWS CLI configured with appropriate credentials and a default region.


import boto3
from botocore.exceptions import ClientError

# Initialize a DynamoDB client
dynamodb = boto3.resource('dynamodb', region_name='us-east-1')

def create_music_table():
    try:
        table = dynamodb.create_table(
            TableName='Music',
            KeySchema=[
                {
                    'AttributeName': 'Artist',
                    'KeyType': 'HASH'  # Partition key
                },
                {
                    'AttributeName': 'SongTitle',
                    'KeyType': 'RANGE'  # Sort key
                }
            ],
            AttributeDefinitions=[
                {
                    'AttributeName': 'Artist',
                    'AttributeType': 'S'
                },
                {
                    'AttributeName': 'SongTitle',
                    'AttributeType': 'S'
                },
            ],
            ProvisionedThroughput={
                'ReadCapacityUnits': 5,
                'WriteCapacityUnits': 5
            }
        )
        table.wait_until_exists()
        print(f"Table 'Music' created successfully.")
        return table
    except ClientError as e:
        if e.response['Error']['Code'] == 'ResourceInUseException':
            print("Table 'Music' already exists.")
            return dynamodb.Table('Music')
        else:
            raise

def add_music_item(table, artist, title, album, year):
    try:
        table.put_item(
            Item={
                'Artist': artist,
                'SongTitle': title,
                'Album': album,
                'Year': year
            }
        )
        print(f"Added item: {artist} - {title}")
    except ClientError as e:
        print(f"Error adding item: {e}")

def get_music_item(table, artist, title):
    try:
        response = table.get_item(
            Key={
                'Artist': artist,
                'SongTitle': title
            }
        )
        item = response.get('Item')
        if item:
            print(f"Retrieved item: {item}")
            return item
        else:
            print(f"Item not found: {artist} - {title}")
            return None
    except ClientError as e:
        print(f"Error getting item: {e}")

if __name__ == '__main__':
    music_table = create_music_table()

    if music_table:
        # Add an item
        add_music_item(music_table, "The Beatles", "Yesterday", "Help!", 1965)

        # Retrieve the item
        get_music_item(music_table, "The Beatles", "Yesterday")

        # Add another item
        add_music_item(music_table, "Queen", "Bohemian Rhapsody", "A Night at the Opera", 1975)
        get_music_item(music_table, "Queen", "Bohemian Rhapsody")

This Python script first attempts to create a DynamoDB table named 'Music' with 'Artist' as the partition key and 'SongTitle' as the sort key. It then adds two sample music items to the table and subsequently retrieves them. Error handling is included to manage cases where the table might already exist DynamoDB Python examples.