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

# HowToScaleGlobally

# DynamoDB at Scale: Global Read and Write

This guide explains how to scale **Amazon DynamoDB** for high throughput and global availability with minimal setup.

***

## 1. Key Features for Scaling

* **Auto Scaling** – Automatically adjusts read/write capacity based on traffic.
* **On-Demand Mode** – Pay per request, scales instantly without capacity planning.
* **Global Tables** – Multi-Region replication for low-latency reads/writes.

***

## 2. Setup Steps

### Step 1: Create DynamoDB Table

* Go to **DynamoDB > Create Table**.
* Set **Primary Key** (Partition key or Partition + Sort key).
* Choose **On-Demand** (recommended for unpredictable workloads) OR **Provisioned with Auto Scaling**.

***

### Step 2: Enable Auto Scaling (if Provisioned Mode)

* Enable **Read/Write Auto Scaling**.
* Set target utilization (e.g., 70%).
* DynamoDB adjusts capacity units automatically.

***

### Step 3: Enable Global Tables

1. Go to **Table > Global Tables > Add Region**.
2. Select additional AWS Regions.
3. DynamoDB will replicate data across Regions with **multi-active writes**.

   * All Regions can **read/write** simultaneously.
   * Conflict resolution is **last-writer-wins** based on timestamp.

***

### Step 4: Optimize for Scale

* Use **partition keys with high cardinality** to distribute load.
* Use **DAX (DynamoDB Accelerator)** for caching if read-heavy.
* Monitor with **CloudWatch metrics** (throttle events, consumed capacity).

***

## 3. Verification

* Insert data in Region A → Verify it appears in Region B.
* Perform read/write from multiple Regions with low latency.

***

## 4. Notes

* Global tables support **multi-Region, multi-master replication**.
* Use **IAM roles** to control access at scale.
* Combine with **API Gateway + Lambda** for serverless global apps.
