> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# NoSQL HA With DynamoDB

> Overview of Amazon DynamoDB, NoSQL data models, and high-availability multi-region design patterns including transactions, global tables, backups, and resilience best practices

Welcome. This lesson covers Amazon DynamoDB, NoSQL database models, and high-availability (HA) design patterns. The content focuses on concepts you’ll need for system design and certification exams, and on practical guidance for building resilient, globally distributed NoSQL solutions.

## NoSQL vs SQL

NoSQL (short for "not only SQL") refers to non-relational databases that support flexible schemas and a variety of data models. SQL databases (relational) work best with well-defined schemas and normalized relations. NoSQL systems excel when you need horizontal scalability, low-latency reads/writes, and to store semi-structured or unstructured data at large scale.

![A split infographic comparing SQL (shown as a table/grid of boxes on the left) with NoSQL (shown as stacked key → value pairs on the right).](https://mintcdn.com/kodekloud-c4ac6d9a/iUH-E6aFfTq3W6nc/images/AWS-Certified-DevOps-Engineer-Professional/Domain-3-Resilient-Cloud-Solutions/NoSQL-HA-With-DynamoDB/sql-vs-nosql-infographic-split.jpg?fit=max\&auto=format\&n=iUH-E6aFfTq3W6nc\&q=85\&s=d0b946869e84f28ca3efa726d51430be)

## NoSQL types

NoSQL databases come in multiple types, each optimized for particular access patterns and workloads:

| Type | Use case | Typical examples |
| - | - | - |
| Key-value store | Simple, fast lookups by key | Session stores, caching |
| Document store | Nested or semi-structured data, flexible schema | Content management, user profiles |
| Column-family store | Wide tables, analytical queries across columns | Time-series, event data |
| Graph database | Relationship-heavy queries and traversals | Social graphs, recommendations |

![A NoSQL infographic showing four types of databases. It has colored icons labeled Key-Value Stores, Document Stores, Column-Family Stores, and Graph Databases.](https://mintcdn.com/kodekloud-c4ac6d9a/iUH-E6aFfTq3W6nc/images/AWS-Certified-DevOps-Engineer-Professional/Domain-3-Resilient-Cloud-Solutions/NoSQL-HA-With-DynamoDB/nosql-types-keyvalue-document-columnfamily-graph.jpg?fit=max\&auto=format\&n=iUH-E6aFfTq3W6nc\&q=85\&s=61a7aed04c1cbef38675fe904f0fa538)

## DynamoDB overview

Amazon DynamoDB is a fully managed NoSQL database service on AWS. It is primarily a key-value store with first-class support for document-like, nested attributes. Key capabilities include:

* Fully managed, serverless operation with seamless autoscaling.
* Multi-AZ replication for durability and high availability.
* Low-latency single-digit millisecond and sub-millisecond read performance.
* Integration with DynamoDB Streams for item-level change events.
* Optional DynamoDB Accelerator (DAX) for an in-memory read cache to support ultra-low-latency read-heavy workloads.

DAX improves read latency but does not support DynamoDB transactional APIs (TransactWriteItems / TransactGetItems) and does not provide strongly consistent reads. Use DAX only for eventual-consistency read caching scenarios.

![A slide titled "Features" showing a central blue database icon surrounded by circular blue icons and labels representing capabilities like stream integration, AWS ecosystem integration, performance at scale, fully managed service, seamless scalability, and high availability.](https://mintcdn.com/kodekloud-c4ac6d9a/iUH-E6aFfTq3W6nc/images/AWS-Certified-DevOps-Engineer-Professional/Domain-3-Resilient-Cloud-Solutions/NoSQL-HA-With-DynamoDB/db-features-stream-aws-scalability-availability.jpg?fit=max\&auto=format\&n=iUH-E6aFfTq3W6nc\&q=85\&s=4ccbcf0d9fd8afc68e9f8ad16293d37a)

## Transactions and ACID

Although DynamoDB is a NoSQL store, it provides transactional APIs (TransactWriteItems and TransactGetItems) that give ACID semantics within a single AWS Region. Transactions ensure:

* Atomicity — Either all operations in the transaction succeed or none do.
* Consistency — Conditional checks and constraints are enforced; invalid operations cause transaction failure.
* Isolation — Partial changes are not visible before transaction commit.
* Durability — Committed changes persist and survive failures due to multi-AZ replication.

DynamoDB single-item operations are durable thanks to multi-AZ replication, but multi-item or multi-table ACID guarantees require the transactional APIs.

![A presentation slide titled "DynamoDB Transactions – ACID Properties" showing four colored panels labeled Atomicity, Consistency, Isolation, and Durability. Each panel includes a simple icon underneath representing the respective concept.](https://mintcdn.com/kodekloud-c4ac6d9a/iUH-E6aFfTq3W6nc/images/AWS-Certified-DevOps-Engineer-Professional/Domain-3-Resilient-Cloud-Solutions/NoSQL-HA-With-DynamoDB/dynamodb-transactions-acid-properties.jpg?fit=max\&auto=format\&n=iUH-E6aFfTq3W6nc\&q=85\&s=833ba070897b9aa4d446ffc985e3beca)

## Basic DynamoDB elements

Understand these core concepts before modeling your data:

| Element | Description |
| - | - |
| Table | A collection of items (rows) |
| Item | A single record in a table (analogous to a row) |
| Attribute | A named field/value pair; attributes can be nested (flexible schema) |
| Primary key | Uniquely identifies an item. Two types: simple (partition key only) or composite (partition key + sort key) |

Example item (employees table):

```json theme={null}
{
  "EmployeeID": "E67890",
  "FirstName": "Jane",
  "LastName": "Smith",
  "Email": "jane.smith@example.com",
  "Position": "Product Manager",
  "Department": "Product",
  "HireDate": "2019-03-15",
  "ContactInfo": {
    "PhoneNumber": "555-1234",
    "Address": "123 Main St, Anytown, USA"
  }
}
```

### Composite keys

Composite primary keys (partition key + sort key) let you model one-to-many relationships and time-ordered data. Use the partition key for distribution and the sort key for range queries, sorting, and efficient retrieval of related items.

## Global tables and multi-region replication

DynamoDB global tables enable multi-region replication, allowing you to deploy table replicas in multiple AWS Regions for lower-latency reads and multi-region resilience. Global tables replicate writes asynchronously between regions—replication is typically fast (often within seconds), but it is eventually consistent.

Global tables are multi-region and replicate asynchronously. Do not assume immediate, cross-region strong consistency—design your application to tolerate brief replication lag or consider conflict resolution strategies for concurrent regional writes.

## Backups and point-in-time recovery (PITR)

DynamoDB supports on-demand backups and point-in-time recovery (PITR) for continuous protection within a region. For disaster recovery (DR) and long-term retention, use AWS Backup to create cross-region and cross-account backups.

![An architecture diagram titled "Cross-Region and Cross-Account Backup (CRAB)" showing an AWS Organization with a Source Account and Destination Account in separate regions. Each account contains AWS Backup and an AWS Vault protecting a DynamoDB instance, with arrows indicating cross-account/cross-region backup replication.](https://mintcdn.com/kodekloud-c4ac6d9a/iUH-E6aFfTq3W6nc/images/AWS-Certified-DevOps-Engineer-Professional/Domain-3-Resilient-Cloud-Solutions/NoSQL-HA-With-DynamoDB/aws-cross-region-cross-account-backup.jpg?fit=max\&auto=format\&n=iUH-E6aFfTq3W6nc\&q=85\&s=b7dd049bae6db75be389d6227e8d74b0)

## Single-region architecture (limitations)

A common simple architecture uses API Gateway -> Lambda -> DynamoDB in a single region. While cost-effective and straightforward, this pattern creates a single-region point of failure: if the region becomes unavailable, the entire application can be unavailable.

![A slide titled "Single Region (Before)" showing an AWS architecture in us-east-1: Amazon API Gateway -> AWS Lambda -> Amazon DynamoDB inside a dashed region. A callout notes this is a single point of failure (if us-east-1 goes down, the app becomes unavailable).](https://mintcdn.com/kodekloud-c4ac6d9a/iUH-E6aFfTq3W6nc/images/AWS-Certified-DevOps-Engineer-Professional/Domain-3-Resilient-Cloud-Solutions/NoSQL-HA-With-DynamoDB/single-region-api-gateway-lambda-dynamodb.jpg?fit=max\&auto=format\&n=iUH-E6aFfTq3W6nc\&q=85\&s=7b3bc7af999acaee5da3ec820a091e69)

## Multi-region and active-active architectures

To improve availability, reduce latency for global users, and avoid regional single points of failure, replicate data across multiple regions. Common approaches:

* Global tables: automatic cross-region replication (eventual consistency).
* Active-active: run full application stacks in multiple regions and route traffic (Route 53, geolocation-based routing, or latency-based routing). Use global tables or other replication mechanisms for the data tier.
* Active-passive failover: a primary region accepts writes while secondary read-only regions remain on standby for failover.

The diagram below shows an active-active multi-region deployment with local front-end and app tiers in each region, DynamoDB global tables replicating data, and continuous backups for recovery.

![An AWS "Active-Active" multi-region architecture diagram showing two mirrored regions with Elastic Load Balancers, VPCs, availability zones, and auto-scaling front-end and application servers. Route 53 handles routing while DynamoDB global tables provide automatic replication and continuous backup.](https://mintcdn.com/kodekloud-c4ac6d9a/iUH-E6aFfTq3W6nc/images/AWS-Certified-DevOps-Engineer-Professional/Domain-3-Resilient-Cloud-Solutions/NoSQL-HA-With-DynamoDB/aws-active-active-multi-region-architecture.jpg?fit=max\&auto=format\&n=iUH-E6aFfTq3W6nc\&q=85\&s=c2a05511eeba1e6854c9ccb1d937fba4)

## Design recommendations for HA and global scale

* Choose your primary access pattern first; model DynamoDB keys (partition + sort keys) to satisfy that pattern.
* Prefer single-table designs for many access patterns to reduce cross-partition queries, but balance complexity and maintainability.
* Use transactions for strong ACID requirements within a region; avoid relying on cross-region transactional guarantees.
* When using global tables, design for eventual consistency and conflict resolution for concurrent writes from multiple regions.
* Complement global tables with cross-region backups (AWS Backup) and automated failover plans for robust DR.

## Key takeaways

* DynamoDB is a highly scalable, fully managed NoSQL database ideal for key-value and document patterns.
* Use transactional APIs when you need ACID guarantees within a region; DynamoDB’s durability benefits from multi-AZ replication.
* Global tables provide automatic cross-region replication for low-latency local reads but are eventually consistent—plan for replication lag.
* Combine global tables, cross-region backups, and multi-region deployment patterns (active-active or active-passive) to meet availability and resilience requirements.

## Links and references

* Amazon DynamoDB documentation: [https://docs.aws.amazon.com/dynamodb/](https://docs.aws.amazon.com/dynamodb/)
* DynamoDB transactions: [https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/transaction-apis.html](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/transaction-apis.html)
* Global tables: [https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/globaltables.html](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/globaltables.html)
* DynamoDB Accelerator (DAX): [https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DAX.html](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DAX.html)
* AWS Backup: [https://docs.aws.amazon.com/backup/](https://docs.aws.amazon.com/backup/)

> **[Watch Video](https://learn.kodekloud.com/user/courses/aws-certified-devops-engineer-professional/module/614fb8a5-8397-4ea6-9d7c-fe05ebc43d18/lesson/83c8b649-011a-4ed3-84c9-89f0b53f6e20)**


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.