What Is Amazon DocumentDB (with MongoDB Compatibility) - Amazon DocumentDB
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

What Is Amazon DocumentDB (with MongoDB Compatibility)

Amazon DocumentDB (with MongoDB compatibility) is a fast, reliable, and fully managed database service. Amazon DocumentDB makes it easy to set up, operate, and scale MongoDB-compatible databases in the cloud. With Amazon DocumentDB, you can run the same application code and use the same drivers and tools that you use with MongoDB.

Before using Amazon DocumentDB, you should review the concepts and features described in How It Works. After that, complete the steps in Get Started Guide.

Overview of Amazon DocumentDB

The following are some high-level features of Amazon DocumentDB:

  • Amazon DocumentDB supports two types of clusters: instance-based clusters and elastic clusters. Elastic clusters support workloads with millions of reads/writes per second and petabytes of storage capacity. For more information about elastic clusters, see Using Amazon DocumentDB elastic clusters. The content below refers to Amazon DocumentDB instance-based clusters .

  • Amazon DocumentDB automatically grows the size of your storage volume as your database storage needs grow. Your storage volume grows in increments of 10 GB, up to a maximum of 128 TiB. You don't need to provision any excess storage for your cluster to handle future growth.

  • With Amazon DocumentDB, you can increase read throughput to support high-volume application requests by creating up to 15 replica instances. Amazon DocumentDB replicas share the same underlying storage, lowering costs and avoiding the need to perform writes at the replica nodes. This capability frees up more processing power to serve read requests and reduces the replica lag time—often down to single digit milliseconds. You can add replicas in minutes regardless of the storage volume size. Amazon DocumentDB also provides a reader endpoint, so the application can connect without having to track replicas as they are added and removed.

  • Amazon DocumentDB lets you scale the compute and memory resources for each of your instances up or down. Compute scaling operations typically complete in a few minutes.

  • Amazon DocumentDB runs in Amazon Virtual Private Cloud (Amazon VPC), so you can isolate your database in your own virtual network. You can also configure firewall settings to control network access to your cluster.

  • Amazon DocumentDB continuously monitors the health of your cluster. On an instance failure, Amazon DocumentDB automatically restarts the instance and associated processes. Amazon DocumentDB doesn't require a crash recovery replay of database redo logs, which greatly reduces restart times. Amazon DocumentDB also isolates the database cache from the database process, enabling the cache to survive an instance restart.

  • On instance failure, Amazon DocumentDB automates failover to one of up to 15 Amazon DocumentDB replicas that you create in other Availability Zones. If no replicas have been provisioned and a failure occurs, Amazon DocumentDB tries to create a new Amazon DocumentDB instance automatically.

  • The backup capability in Amazon DocumentDB enables point-in-time recovery for your cluster. This feature allows you to restore your cluster to any second during your retention period, up to the last 5 minutes. You can configure your automatic backup retention period up to 35 days. Automated backups are stored in Amazon Simple Storage Service (Amazon S3), which is designed for 99.999999999% durability. Amazon DocumentDB backups are automatic, incremental, and continuous, and they have no impact on your cluster performance.

  • With Amazon DocumentDB, you can encrypt your databases using keys that you create and control through Amazon Key Management Service (Amazon KMS). On a database cluster running with Amazon DocumentDB encryption, data stored at rest in the underlying storage is encrypted. The automated backups, snapshots, and replicas in the same cluster are also encrypted.

If you are new to Amazon services, use the following resources to learn more:

  • Amazon offers services for computing, databases, storage, analytics, and other functionality. For an overview of all Amazon services, see Cloud Computing with Amazon Web Services.

  • Amazon provides a number of database services. For guidance on which service is best for your environment, see Databases on Amazon.

Clusters

A cluster consists of 0 to 16 instances and a cluster storage volume that manages the data for those instances. All writes are done through the primary instance. All instances (primary and replicas) support reads. The cluster's data is stored in the cluster volume with copies in three different Availability Zones.


            Amazon DocumentDB cluster containing primary instance in Availability Zone a, writing to cluster volume for replicas in zones b and c.

Amazon DocumentDB 5.0 instance-based clusters support two storage configurations for a database cluster: Amazon DocumentDB standard and Amazon DocumentDB I/O-optimized. For more information see Amazon DocumentDB cluster storage configurations.

Instances

An Amazon DocumentDB instance is an isolated database environment in the cloud. An instance can contain multiple user-created databases. You can create and modify an instance using the Amazon Web Services Management Console or the Amazon CLI.

The computation and memory capacity of an instance are determined by its instance class. You can select the instance that best meets your needs. If your needs change over time, you can choose a different instance class. For instance class specifications, see Instance Class Specifications.

Amazon DocumentDB instances run only in the Amazon VPC environment. Amazon VPC gives you control of your virtual networking environment: You can choose your own IP address range, create subnets, and configure routing and access control lists (ACLs).

Before you can create Amazon DocumentDB instances, you must create a cluster to contain the instances.

Not all instance classes are supported in every region. The following table shows which instance classes are supported in each region.

Supported instance classes by Region
Instance Classes
Region R6G R5 R4 T4G T3

US East (Ohio)

Supported

Supported

Supported

Supported

Supported

US East (N. Virginia)

Supported

Supported

Supported

Supported

Supported

US West (Oregon)

Supported

Supported

Supported

Supported

Supported

South America (São Paulo)

Supported

Supported

Supported

Supported

Asia Pacific (Hong Kong)

Supported

Supported

Supported

Supported

Asia Pacific (Hyderabad)

Supported

Supported

Asia Pacific (Mumbai)

Supported

Supported

Supported

Supported

Asia Pacific (Seoul)

Supported

Supported

Supported

Supported

Asia Pacific (Sydney)

Supported

Supported

Supported

Supported

Asia Pacific (Singapore)

Supported

Supported

Supported

Supported

Asia Pacific (Tokyo)

Supported

Supported

Supported

Supported

Canada (Central)

Supported

Supported

Supported

Supported

Europe (Frankfurt)

Supported

Supported

Supported

Supported

Europe (Ireland)

Supported

Supported

Supported

Supported

Supported

Europe (London)

Supported

Supported

Supported

Supported

Europe (Milan)

Supported

Supported

Supported

Supported

Europe (Paris)

Supported

Supported

Supported

Supported

Middle East (UAE)

Supported

Supported

Supported

Supported

China (Beijing) Region

Supported

Supported

Supported

Supported

China (Ningxia)

Supported

Supported

Supported

Supported

Amazon GovCloud (US-West)

Supported

Supported

Supported

Supported

Amazon GovCloud (US-East)

Supported

Supported

Supported

Supported

Regions and Availability Zones

Regions and Availability Zones define the physical locations of your cluster and instances.

Regions

Amazon Cloud computing resources are housed in highly available data center facilities in different areas of the world (for example, North America, Europe, or Asia). Each data center location is called a Region.

Each Amazon Region is designed to be completely isolated from the other Amazon Regions. Within each are multiple Availability Zones. By launching your nodes in different Availability Zones, you can achieve the greatest possible fault tolerance. The following diagram shows a high-level view of how Amazon Regions and Availability Zones work.


                  Amazon DocumentDB high-level view of Amazon Regions and Availability Zones.

Availability Zones

Each Amazon Region contains multiple distinct locations called Availability Zones. Each Availability Zone is engineered to be isolated from failures in other Availability Zones, and to provide inexpensive, low-latency network connectivity to other Availability Zones in the same Region. By launching instances for a given cluster in multiple Availability Zones, you can protect your applications from the unlikely event of an Availability Zone failing.

The Amazon DocumentDB architecture separates storage and compute. For the storage layer, Amazon DocumentDB replicates six copies of your data across three Amazon Availability Zones. As an example, if you are launching an Amazon DocumentDB cluster in a Region that only supports two Availability Zones, your data storage will be replicated six ways across three Availability Zones but your compute instances will only be available in two Availability Zones.

The following table lists the number of Availability Zones that you can use in a given Amazon Web Services Region to provision compute instances for your cluster.

Region Name Region Availability Zones (compute)

US East (Ohio)

us-east-2

3

US East (N. Virginia)

us-east-1

6

US West (Oregon)

us-west-2

4

South America (São Paulo)

sa-east-1

3

Asia Pacific (Hong Kong)

ap-east-1

3

Asia Pacific (Hyderabad)

ap-south-2

3

Asia Pacific (Mumbai)

ap-south-1

3

Asia Pacific (Seoul)

ap-northeast-2

4

Asia Pacific (Singapore)

ap-southeast-1

3

Asia Pacific (Sydney)

ap-southeast-2

3

Asia Pacific (Tokyo)

ap-northeast-1

3

Canada (Central)

ca-central-1

3

China (Beijing) Region

cn-north-1

3

China (Ningxia)

cn-northwest-1

3

Europe (Frankfurt)

eu-central-1

3

Europe (Ireland)

eu-west-1

3

Europe (London)

eu-west-2

3

Europe (Milan)

eu-south-1

3

Europe (Paris)

eu-west-3

3

Middle East (UAE)

me-central-1

3

Amazon GovCloud (US-West)

us-gov-west-1

3

Amazon GovCloud (US-East)

us-gov-east-1

3

Amazon DocumentDB Pricing

Amazon DocumentDB clusters are billed based on the following components:

  • Instance hours (per hour)—Based on the instance class of the instance (for example, db.r5.xlarge). Pricing is listed on a per-hour basis, but bills are calculated down to the second and show times in decimal form. Amazon DocumentDB usage is billed in one second increments, with a minimum of 10 minutes. For more information, see Managing Instance Classes.

  • I/O requests (per 1 million requests per month) — Total number of storage I/O requests that you make in a billing cycle.

  • Backup storage (per GiB per month) — Backup storage is the storage that is associated with automated database backups and any active database snapshots that you have taken. Increasing your backup retention period or taking additional database snapshots increases the backup storage consumed by your database. Backup storage is metered in GB-months and per second does not apply. For more information, see Backing Up and Restoring in Amazon DocumentDB.

  • Data transfer (per GB) — Data transfer in and out of your instance from or to the internet or other Amazon Regions.

For detailed information, see Amazon DocumentDB pricing.

Free trial

You can try Amazon DocumentDB for free using the 1-month free trial. For more information, see Free trial in Amazon DocumentDB pricing or see the Amazon DocumentDB free trial FAQ.

Monitoring

There are several ways that you can track the performance and health of an instance. You can use the free Amazon CloudWatch service to monitor the performance and health of an instance. You can find performance charts on the Amazon DocumentDB console. You can subscribe to Amazon DocumentDB events to be notified when changes occur with an instance, snapshot, parameter group, or security group.

For more information, see the following:

Interfaces

There are multiple ways for you to interact with Amazon DocumentDB, including the Amazon Web Services Management Console and the Amazon CLI.

Amazon Web Services Management Console

The Amazon Web Services Management Console is a simple web-based user interface. You can manage your clusters and instances from the console with no programming required. To access the Amazon DocumentDB console, sign in to the Amazon Web Services Management Console and open the Amazon DocumentDB console at https://console.amazonaws.cn/docdb.

Amazon CLI

You can use the Amazon Command Line Interface (Amazon CLI) to manage your Amazon DocumentDB clusters and instances. With minimal configuration, you can start using all of the functionality provided by the Amazon DocumentDB console from your favorite terminal program.

The mongo Shell

To connect to your cluster to create, read, update, delete documents in your databases, you can use the mongo shell with Amazon DocumentDB. To download and install the mongo 4.0 shell, see Step 4: Install the mongo shell.

MongoDB Drivers

For developing and writing applications against an Amazon DocumentDB cluster, you can also use the MongoDB drivers with Amazon DocumentDB.

What's Next?

The preceding sections introduced you to the basic infrastructure components that Amazon DocumentDB offers. What should you do next? Depending upon your circumstances, see one of the following topics to get started: