Skip to content

How do I create an Aurora PostgreSQL-Compatible global database?

5 minute read
0

I want to create an Amazon Aurora PostgreSQL-Compatible Edition global database.

Short Description

You can use Aurora global databases for globally distributed applications in up to 10 secondary AWS Regions. Because these databases can span multiple Regions, you can support local reads from read-only secondary database clusters in multiple Regions. Aurora global databases also provide a fast recovery mechanism in case of a Region failure.

Before you create an Aurora PostgreSQL-Compatible global database, take the following actions:

Resolution

Note: If you receive errors when you run AWS Command Line Interface (AWS CLI) commands, then see Troubleshooting errors for the AWS CLI. Also, make sure that you're using the most recent AWS CLI version.

Create an Aurora PostgreSQL-Compatible database cluster

To create the Aurora PostgreSQL-Compatible database cluster, use the Aurora and Amazon Relational Database Service (Amazon RDS) console. If you already have an Aurora PostgreSQL-Compatible database cluster, then skip to the next section.

Complete the following steps:

  1. Open the Aurora and RDS console in your primary Region.
  2. Choose Create database, and then choose Standard create.
  3. Select Aurora (PostgreSQL Compatible).
  4. For Available versions, choose the version of PostgreSQL that you want to use.
  5. For Credentials management, choose Self managed.
  6. Configure the database for your use case, and then choose Create database.

Use the Aurora cluster to create an Aurora PostgreSQL-Compatible global database

An Aurora PostgreSQL global database needs at least one secondary Aurora database cluster in a different Region than the primary Aurora database cluster. You can attach up to 10 secondary database clusters to your Aurora PostgreSQL global database.

To create a secondary Aurora database cluster in a different Region, complete the following steps:

  1. Open the Aurora and RDS console in your primary Region.
  2. In the navigation pane, choose Databases.
  3. Choose your Aurora PostgreSQL database.
  4. Choose Actions, and then choose Add AWS Region.
  5. For Global database settings, enter a name for you global database.
    Note: You must use a unique name for each of your Aurora database clusters across all Regions.
  6. For AWS Region, select the secondary Region.
  7. Configure the database for your use case, and then choose Add Region.

Migrate an RDS for PostgreSQL snapshot to an Aurora PostgreSQL-Compatible global database

Complete the following steps:

  1. Open the Amazon RDS console in your primary Region.
  2. In the navigation pane, choose Snapshots.
  3. Choose the RDS for PostgreSQL snapshot that you want to migrate.
  4. Choose Actions, and then choose Migrate snapshot.
  5. In the Instance specifications section, select aurora-postgresql.
  6. Choose Migrate.
  7. In the navigation pane, choose Databases.
  8. Choose the migrated Aurora PostgreSQL-Compatible cluster.
  9. Choose Actions, and then choose Add AWS Region.
  10. In the Global database settings section, enter the name for your global database.
  11. In the AWS Region section, select the secondary Region.
  12. Choose Add Region.

Migrate an RDS for PostgreSQL database to an Aurora PostgreSQL-Compatible global database

Complete the following steps:

  1. Open the Aurora and RDS console in your primary Region.
  2. In the navigation pane, choose Databases.
  3. Select the RDS for PostgreSQL database that you want to migrate.
  4. Choose Actions, and then choose Create Aurora read replica.
  5. Configure the replica for you use case, and then choose Create read replica.

After you create the Aurora read replica, you can promote the Aurora read replica. Before you promote the replica, make sure that the RDS for PostgreSQL database doesn't have any activity. Also make sure that the read replica lag is zero.

To promote the Aurora read replica, complete the following steps:

  1. Choose the new Aurora read replica.
  2. Choose Actions, choose promote, and then choose Promote read replica.
    Note: After the promotion process, the Aurora replica cluster becomes a Regional Aurora database cluster with a writer instance.
  3. Choose the newly promoted Regional Aurora database cluster.
  4. Choose Actions, and then choose Add AWS Region.
  5. For Global database settings, enter the name for your global database.
  6. For AWS Region, select the secondary Region.
  7. Choose Add Region.

Create a headless Aurora database cluster in a secondary Region

Aurora global databases require at least one secondary Aurora database cluster in a different Region. To reduce compute costs, you can create a headless secondary Aurora database cluster so that you're only charged for the storage. While this setup method can incur higher recovery time objective (RTO), it can reduce the cost of your disaster recover (DR) setup.

To create the headless Aurora database cluster for PostgreSQL, run the following create-db-cluster command:

aws rds —region your-target-region \\  
create-db-cluster \\  
\--db-cluster-identifier your-value \\  
\--global-cluster-identifier your-value \\  
\--engine aurora-postgresql \\  
\--kms-key-id your-value \\--engine-version your-value \\  
\--db-cluster-parameter-group-name your-value\\  
\--db-subnet-group-name your-value \\  
\--vpc-security-group-ids your-value \\  
\--backup-retention-period your-value

Note: Replace your-target-region with your Region and your-value with your values.

Related information

Using Amazon Aurora Global Database

Guidance for disaster recovery using Amazon Aurora

AWS OFFICIALUpdated 9 months ago