Domain 1 β€” Module 1 of 15 7%
1 of 31 overall
Domain 1: Design and develop database solutions Free ⏱ ~14 min read

Cosmos DB β€” The Big Picture

Understand the Azure Cosmos DB resource hierarchy, NoSQL API, throughput models, global distribution, SLAs, the emulator, and when to choose free tier vs serverless vs provisioned.

What is Azure Cosmos DB?

Simple explanation

Think of Cosmos DB as a planet-scale filing cabinet. You have one account (the office), which holds databases (rooms), which hold containers (filing drawers), which hold items (individual documents). The magic? You can replicate your filing cabinet to offices around the world, and anyone reads from the nearest copy β€” in single-digit milliseconds.

You pay for how fast the drawers open (throughput in RU/s) and how much paper you store (GB). That’s really it.

Priya’s scenario: choosing Cosmos DB for NovaSaaS

πŸš€ Priya at NovaSaaS is architecting a multi-tenant SaaS platform serving 200K users across 12 countries. Her requirements:

  • Low latency globally β€” users in Sydney, London, and SΓ£o Paulo all expect sub-10ms reads
  • Elastic scale β€” Black Friday traffic is 5Γ— normal; she can’t over-provision year-round
  • Multi-tenant isolation β€” each tenant’s data stays logically separated
  • 99.99%+ availability β€” SaaS customers expect always-on

Cosmos DB checks every box. Let’s see how it’s structured.

Resource hierarchy

Every Cosmos DB deployment follows this hierarchy:

Azure Subscription
  └── Cosmos DB Account          ← endpoint + keys, billing root
        └── Database              ← logical namespace, optional shared throughput
              └── Container       ← the "table" β€” partitioned, indexed, queried
                    └── Item      ← a JSON document (max 2 MB)
LevelWhat it doesKey facts
AccountTop-level resource. Holds the endpoint URI and keys.Choose an API when creating the account; do not assume one account exposes every API.
DatabaseLogical grouping of containers.Optional: you can provision shared throughput at this level.
ContainerWhere data lives. Think of it as a table or collection.Has a partition key, indexing policy, TTL, unique keys, throughput.
ItemA single JSON document.Max 2 MB per item. Identified by id + partition key value.

Priya creates one account, one database novasaas, and separate containers per domain β€” users, projects, billing.

Throughput: database vs container

AspectDatabase throughput (shared)Container throughput (dedicated)
RU/s poolShared across all containers in the databaseDedicated to a single container
Minimum400 RU/s (or 1000 with autoscale)400 RU/s (or 1000 with autoscale)
Best forMany containers with variable, low trafficHigh-traffic containers that need guaranteed capacity
OverrideIndividual containers can opt out with dedicated throughputN/A β€” each container has its own RU/s
Cost efficiencyGreat when most containers are idleBetter when one container dominates traffic

Priya uses shared throughput at the database level for dev/test environments (saves cost), and dedicated container throughput in production for her projects container that handles 80% of traffic.

Exam tip: RU/s minimum with shared throughput

The base shared-throughput minimum is 400 RU/s (manual) or 1,000 RU/s (autoscale max); storage, container count and throughput history can raise it. Containers share the pool without a guaranteed per-container allocation. Ten containers sharing 1,000 RU/s do not each receive a reserved 100 RU/s.

You can also mix: have some containers on the shared pool and others on dedicated throughput within the same database.

Global distribution and SLAs

Cosmos DB was built for global distribution from day one:

The applicable SLA depends on the configured regions, write model, service tier and qualifying features. Multi-region multi-write is a documented path to 99.999% availability. Eligible single-write accounts using per-partition automatic failover (PPAF) can also have five-nines write availability; multi-write is not a universal prerequisite.

Do not treat an availability percentage as a promised outage duration or the client-observed latency of every operation. Network distance, consistency, item size and workload affect application behavior. Check the current Cosmos DB availability guidance and the PPAF requirements.

Priya enables multi-region reads across Australia East, UK South, and Brazil South, with writes pinned to Australia East for now. She’ll enable multi-write when her team is ready to handle conflict resolution.

Free tier vs serverless vs provisioned

FeatureFree tierServerlessProvisioned
ThroughputFirst 1,000 RU/s free (then standard pricing)Auto-scales per request, billed per RU consumedYou set RU/s (manual or autoscale)
StorageFirst 25 GB freeCharged by stored data; resource limits applyCharged by stored data; resource limits apply
Best forDev/test, learning, small appsBursty, unpredictable workloadsProduction, predictable traffic
Global distributionβœ… Supported❌ Single-region onlyβœ… Supported
Subscription allowanceOne free-tier accountAccount and service quotas applyAccount and service quotas apply
Idle costEligible usage within allowanceNo reserved RU/s floor; stored data still costs moneyMinimum RU/s cost plus storage

Ravi’s mistake: Ravi leaves provisioned throughput running after a weekend prototype. It continues to incur a throughput charge while idle. Compare an eligible free-tier account, serverless request consumption and storage against the current Microsoft pricing rather than guessing a bill.

Exam tip: serverless limitations

Serverless is great for dev/test but has real limitations: single-region only (no global distribution), no dedicated throughput guarantees, and each physical partition supports at most 5,000 RU/s. The exam loves testing whether serverless supports multi-region β€” it doesn’t. Note: you can now convert a serverless account to provisioned throughput in-place (NoSQL API).

The Cosmos DB emulator

The emulator runs locally on Windows, macOS (Docker), or Linux (Docker). It provides a local endpoint that behaves like the real service:

Endpoint:  https://localhost:8081
Key:       C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==

This is the emulator’s documented default development key, not a cloud-account secret. Supported emulator configurations can override it. The emulator does not reproduce every cloud feature or performance characteristic.

🎬 Video walkthrough

Flashcards

Question

What is the Cosmos DB resource hierarchy from top to bottom?

Click or press Enter to reveal answer

Question

What availability SLA does Cosmos DB offer with multi-region multi-write?

Click or press Enter to reveal answer

Question

Can serverless Cosmos DB accounts use global distribution?

Click or press Enter to reveal answer

Question

What is the well-known emulator key?

Click or press Enter to reveal answer

Knowledge check

Knowledge Check

Priya needs to choose a throughput model for NovaSaaS production. Her 'projects' container handles 80% of traffic. Which approach is best?

Knowledge Check

Ravi sets up a Cosmos DB account for a weekend prototype. He expects very light, unpredictable traffic, doesn't need multi-region, and hasn't used a free tier account in this subscription. Which model is cheapest?

Knowledge Check

Which of these is true about the Cosmos DB emulator?


Next up: Design Data Model β€” learn how to think access-pattern-first and design containers that match your queries, not your entity-relationship diagrams.