Amazon DocumentDB
Aurora, but for MongoDB. Same trick: AWS reimplemented the engine on its own distributed storage layer, kept the wire protocol, and sells it as a managed cluster. If you know the Aurora deployment model, you already know this one — primary + replicas over one auto-growing shared volume, replicated across 3 AZs.
Aurora, nhưng cho MongoDB. Vẫn chiêu đó: AWS viết lại engine trên tầng storage phân tán của họ, giữ nguyên wire protocol, rồi bán dưới dạng cluster managed. Nếu đã nắm mô hình triển khai Aurora thì bạn nắm luôn cái này — primary + replica trên một volume dùng chung tự lớn, replicate qua 3 AZ.
Reach for itNên dùng
- An existing MongoDB application you want managed without rewriting the data layerĐã có ứng dụng MongoDB, muốn được managed mà không phải viết lại tầng data
- JSON documents with nested structure and rich queries (filters on sub-fields, aggregations)Document JSON lồng nhau, query phong phú (lọc theo sub-field, aggregation)
- Read-heavy workloads — scale out with read replicas behind the reader endpointWorkload nặng đọc — scale ngang bằng read replica sau reader endpoint
- You want Aurora-grade HA (3-AZ storage, automatic failover) for a document storeMuốn HA cỡ Aurora (storage 3 AZ, tự failover) cho một document store
Not the right toolKhông hợp
- Simple key-value access at any scale, serverless billing → DynamoDBTruy cập key-value đơn giản ở mọi quy mô, tính phí serverless → DynamoDB
- Relational schema, joins, transactions across tables → Aurora / RDSSchema quan hệ, join, transaction nhiều bảng → Aurora / RDS
- Full-text search / log analytics over documents → OpenSearchTìm kiếm full-text / phân tích log trên document → OpenSearch
- You need a specific MongoDB version or feature AWS hasn't implemented — check compatibility before committingCần version hoặc tính năng MongoDB cụ thể mà AWS chưa làm — kiểm tra tương thích trước khi chốt
1 · What it is1 · Nó là gì
One sentence to remember the whole service: DocumentDB is to MongoDB what Aurora is to PostgreSQL/MySQL.
Một câu để nhớ cả service: DocumentDB với MongoDB = Aurora với PostgreSQL/MySQL.
- Aurora is an "AWS implementation" of PostgreSQL / MySQL; DocumentDB is the same for MongoDB (a NoSQL database).Aurora là "bản AWS" của PostgreSQL / MySQL; DocumentDB là bản tương tự cho MongoDB (một NoSQL database).
- MongoDB is used to store, query, and index JSON data — documents, not rows. Fields can differ per document; no fixed schema to migrate.MongoDB dùng để lưu, query và index dữ liệu JSON — document chứ không phải row. Mỗi document có thể khác field; không có schema cố định phải migrate.
- Because the wire protocol is MongoDB's, existing drivers and tools connect unchanged — that's the whole selling point.Vì wire protocol là của MongoDB, driver và công cụ sẵn có kết nối được ngay — đó chính là điểm bán hàng.
- Automatically scales to workloads with millions of requests per second.Tự scale tới workload hàng triệu request mỗi giây.
2 · Cluster architecture2 · Kiến trúc cluster
Instances are stateless compute over a shared volume. Kill one and you lose capacity, not data — a replica is promoted and the volume is untouched.
Instance chỉ là compute không trạng thái đặt trên volume dùng chung. Mất một con là mất capacity chứ không mất data — một replica được promote, volume vẫn nguyên.
- Similar deployment concepts to Aurora: a cluster = one primary (the only writer) + up to 15 read replicas, all reading the same volume.Khái niệm triển khai giống Aurora: một cluster = một primary (writer duy nhất) + tối đa 15 read replica, tất cả đọc chung một volume.
- Two endpoints do the routing for you: the cluster endpoint always points at the current primary (so failover is transparent), the reader endpoint load-balances across replicas.Hai endpoint lo việc định tuyến: cluster endpoint luôn trỏ vào primary hiện tại (nên failover trong suốt), reader endpoint cân tải qua các replica.
- Fully managed, highly available with replication across 3 AZs. Six copies of the data; a failed AZ costs you nothing in durability.Fully managed, HA cao với replicate qua 3 AZ. Sáu bản copy; mất một AZ không ảnh hưởng độ bền dữ liệu.
- Storage automatically grows in increments of 10 GB as you write — no volume sizing, no downtime to extend.Storage tự lớn theo bước 10 GB khi bạn ghi — không phải chọn size, không downtime để mở rộng.
- The cluster lives in your VPC, reached over TLS with database users — so a Lambda or app in a private subnet needs the usual security-group path.Cluster nằm trong VPC của bạn, kết nối qua TLS bằng user database — nên Lambda hay app trong private subnet vẫn cần mở đường security group như thường.
3 · Pricing — four meters3 · Tính phí — bốn đồng hồ
Four separate meters. The one people forget is I/O — a chatty read pattern can cost more than the instances.
Bốn đồng hồ riêng biệt. Cái hay bị quên là I/O — pattern đọc lắt nhắt có khi tốn hơn cả tiền instance.
- Pay for what you use, no upfront costs.Dùng bao nhiêu trả bấy nhiêu, không trả trước.
- On-demand instances — billed per second with a minimum of 10 minutes.On-demand instance — tính theo giây, tối thiểu 10 phút.
- Database I/O — the amount of I/O used when reading and writing, charged per million I/Os.Database I/O — lượng I/O khi đọc và ghi, tính theo mỗi triệu I/O.
- Database storage — per GB/month of the cluster volume.Database storage — mỗi GB/tháng của volume cluster.
- Backup storage — per GB/month, held in S3, separate from the database storage meter.Backup storage — mỗi GB/tháng, để trên S3, tính tách khỏi database storage.
Exam reflexesPhản xạ khi thi
- "Migrate our MongoDB workload to a managed AWS service" → DocumentDB. The word MongoDB in the question is the whole signal."Chuyển workload MongoDB sang dịch vụ managed của AWS" → DocumentDB. Chữ MongoDB trong đề chính là tín hiệu duy nhất cần.
- "JSON documents, but we want serverless and single-digit-ms key lookups" → DynamoDB, not DocumentDB."Document JSON, nhưng muốn serverless và tra key trong vài ms" → DynamoDB, không phải DocumentDB.
- "Scale reads" → add read replicas and point the app at the reader endpoint; the writer stays single."Scale phần đọc" → thêm read replica và trỏ app vào reader endpoint; writer vẫn chỉ một.
- "Pre-provision storage for growth" → trap. It grows itself in 10 GB steps."Provision sẵn storage để phòng lớn lên" → bẫy. Nó tự lớn theo bước 10 GB.
- Anything you know about Aurora's cluster model — endpoints, failover, replicas, shared volume — transfers directly. Answer the question as if it were Aurora.Mọi thứ bạn biết về mô hình cluster của Aurora — endpoint, failover, replica, volume dùng chung — áp dụng nguyên si. Cứ trả lời như đang nói về Aurora.