What Is Amazon DynamoDB? AWS’s Serverless NoSQL Database

Sunucun 3 min read

Amazon DynamoDB is AWS’s serverless, fully managed, distributed NoSQL database. According to the AWS documentation, it delivers single-digit millisecond performance at any scale. You don’t set up servers, patch software or plan maintenance windows; DynamoDB has no version numbers and no maintenance windows. Launched in 2012, the service is designed for high-traffic workloads such as shopping carts, game data, session information and IoT.

Illustration: AWS

How Does DynamoDB Work? Core Concepts

  • Tables, items, attributes: Data is stored as items in tables, and each item contains attributes. Unlike relational databases, items don’t have to share the same columns.
  • Primary key: Each item is uniquely identified by a partition key (optionally combined with a sort key). Data is distributed by this key, so key design is the foundation of performance.
  • Data model: Supports both key-value and document models.
  • Secondary indexes: To query on attributes other than the primary key, you can create up to 5 local secondary indexes (LSI) and, by default, 20 global secondary indexes (GSI) per table.
  • No JOINs: DynamoDB doesn’t support JOIN; AWS recommends denormalizing your data to reduce the number of queries.

Capacity Modes: On-Demand and Provisioned

On-demandProvisioned
BillingPer read/write requestFor the read (RCU) and write (WCU) capacity per second you reserve
ScalingAutomatic; scales to zero with no trafficYou set it; can be adjusted with Auto Scaling
Best forUnpredictable traffic or new applicationsSteady, predictable workloads

DynamoDB is in the AWS always-free tier with 25 GB of storage plus 25 RCU and 25 WCU of provisioned capacity. Check current prices on AWS’s DynamoDB pricing page.

Key Features

  • High availability: Data is replicated across three Availability Zones by default, with a 99.99% availability SLA.
  • Global tables: Replicate data across multiple AWS Regions you choose, all writable (99.999% SLA).
  • ACID transactions: Change multiple items in one or more tables in a single all-or-nothing request.
  • Backups: Point-in-time recovery (PITR) restores a table to any second within the last 35 days, and on-demand full backups cover long-term retention.
  • DynamoDB Streams: Provides item-level changes as a near-real-time stream; used to write triggers with Lambda.
  • Encryption and access: All data is encrypted by default; access is managed with IAM instead of usernames and passwords.
  • DAX: A managed in-memory cache for DynamoDB that can bring read latency down to microseconds.

DynamoDB or RDS?

CriterionDynamoDBAmazon RDS
Data modelNoSQL, key-value and documentRelational (SQL tables)
QueriesBy key and indexes; no JOINsFlexible SQL, JOINs and complex reports
Server managementNone (serverless)You choose an instance class and storage
ScalingAutomatic, up to very high trafficBy upsizing instances and read replicas
Good forSessions, carts, game state, IoT, event dataE-commerce orders, accounting, CMS, reporting

If your access patterns are known in advance and you need very high scale, DynamoDB fits; if you need flexible queries, JOINs and standard SQL tools, RDS is the better choice. We cover RDS in detail in our article what is Amazon RDS.

How to Get Started with DynamoDB

You can create tables with the AWS Console, AWS CLI, NoSQL Workbench or the SDKs. For example, an on-demand table with a UserId partition key:

aws dynamodb create-table \
  --table-name Users \
  --attribute-definitions AttributeName=UserId,AttributeType=S \
  --key-schema AttributeName=UserId,KeyType=HASH \
  --billing-mode PAY_PER_REQUEST

Other articles in the series: AWS Lambda, AWS IAM and Amazon EKS. If you want to run your application and a MySQL/PostgreSQL database on a single fixed-cost server, take a look at our VDS server options.

Conclusion

Amazon DynamoDB is a NoSQL database that needs no server management, scales automatically and delivers consistently low latency. The key to a successful DynamoDB design is defining your access patterns up front and building the partition key, sort key and indexes around them.

Categories

Latest guides