Create Database Subnet Group

What is a DB Subnet Group?

A DB Subnet Group in Amazon DocumentDB is a collection of subnets within a VPC, used to define which subnets the DocumentDB cluster can be deployed in. Each DB Subnet Group must contain at least two subnets in different Availability Zones (AZs) to ensure high availability and redundancy.

Why Create a DB Subnet Group?

  • Select the right network in VPC: The DB Subnet Group helps define which VPC and subnets Amazon DocumentDB can use, allowing for better network control and enhanced security

  • Keep the system running: The database requires at least two subnets in different Availability Zones (AZs). If one AZ fails, the system can continue operating using the other subnet.

  • Automatic failover handling: If the primary instance fails, Amazon DocumentDB will switch to a replica instance in another subnet to ensure uninterrupted operation. A new replica will then be created in the original subnet to maintain the required number of nodes.

Create a DB Subnet Group on AWS

Follow these steps to create a DB Subnet Group on AWS:

  1. Go to the AWS Management Console.

  2. Search for and select the Amazon DocumentDB service.

  3. In the navigation menu, select Subnet groups. documentdb-interface.png

  4. In Subnet groups, click Create.

  5. In the Create DB Subnet Group page:

    • Name: blog-db-subnet-group.

    • Description: blog-db-subnet-group.

    • Select the VPC you are using.

      • In the Add Subnets section, choose the Private Subnets:
      • Select at least two Private Subnets in different AZs (e.g., subnet-xxxxxx1 in AZ us-east-1a, subnet-xxxxxx2 in AZ us-east-1b).
      • Click Add subnet. create-subnet-group.png
  6. Click Create to complete the DB Subnet Group setup. complete.png