I Tried Out Data Groups (Preview) in Amazon Aurora PostgreSQL

I Tried Out Data Groups (Preview) in Amazon Aurora PostgreSQL

Encrypting each tenant's data group with its own KMS key let me restore one data group on its own from a snapshot. The restored data kept the original KMS key and encryption context.
2026.12.03

This page has been translated by machine translation. View original

Introduction

On December 2, 2026, data groups for Amazon Aurora PostgreSQL was announced as a preview.

https://aws.amazon.com/about-aws/whats-new/2026/12/amazon-aurora-data-groups/

Data groups is a feature that treats tenants in a shared cluster as units called data groups, allowing encryption, restoration, and relocation to be performed per tenant.

In this article, I created two data groups, encrypted them with separate KMS keys, restored one of them on its own from a snapshot, and checked the results.

Test Environment

  • Region: US East (Ohio) us-east-2, RDS Database Preview environment
  • Engine: Aurora PostgreSQL 19.0 (19 Beta 4)
  • Storage: Aurora I/O-Optimized
  • Instance class: db.r8g.large
  • AWS CLI: 2.43.2
  • Client: psql

The preview environment endpoint https://rds-preview.us-east-2.amazonaws.com is specified with the AWS CLI --endpoint-url option. This option is omitted from the commands in this article.

The user guide for data groups is on the following page.

https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-data-groups.html

Creating Data Groups

Creating the Cluster

A cluster that uses data groups must have engine version 19.0 and Aurora I/O-Optimized storage (aurora-iopt1).

aws rds create-db-cluster \
  --db-cluster-identifier dgv-c1 \
  --engine aurora-postgresql \
  --engine-version 19.0 \
  --storage-type aurora-iopt1 \
  --master-username postgres \
  --manage-master-user-password

aws rds create-db-instance \
  --db-instance-identifier dgv-c1-i1 \
  --db-cluster-identifier dgv-c1 \
  --db-instance-class db.r8g.large \
  --engine aurora-postgresql

Creating Data Groups with Dedicated KMS Keys

I prepared two KMS keys (key A and key B) and passed the key and encryption context when creating each data group. I created tenantb with the following command. I created tenanta with the same command, specifying key A and {"tenant":"a"}.

aws rds create-data-group \
  --db-cluster-identifier dgv-c1 \
  --data-group-name tenantb \
  --kms-key-id arn:aws:kms:us-east-2:111122223333:key/9f8e7d6c-5b4a-3210-fedc-EXAMPLE22222 \
  --additional-encryption-context '{"tenant":"b"}'

A dedicated key can only be specified when the data group is created, and cannot be changed afterward.

KMS Grants

I retrieved the list of grants for key B. The Constraints of each grant contain the identifier of tenantb (aws:rds:dg-id) and the encryption context added at creation.

aws kms list-grants \
  --key-id 9f8e7d6c-5b4a-3210-fedc-EXAMPLE22222 \
  --query 'Grants[].[Name,Constraints]' \
  --output json
[
    [
        "datagroup-a1b2c3d4-5678-90ab-cdef-EXAMPLE22222",
        {
            "EncryptionContextSubset": {
                "aws:rds:dg-id": "dg-a1b2c3d4-5678-90ab-cdef-EXAMPLE22222",
                "tenant": "b"
            }
        }
    ],
    [
        "",
        {
            "EncryptionContextSubset": {
                "aws:rds:dg-id": "dg-a1b2c3d4-5678-90ab-cdef-EXAMPLE22222",
                "tenant": "b"
            }
        }
    ]
]

Creating Databases

To place a database in a data group, specify the data group name in the TABLESPACE clause of CREATE DATABASE.

CREATE DATABASE orders_a TABLESPACE tenanta;

I created orders_b with the same SQL, replacing the TABLESPACE clause with tenantb.

I connected to each of orders_a and orders_b, created a table, and inserted 1,000 rows into each.

Creating the table and inserting 1,000 rows (orders_a)
CREATE TABLE customer_orders (
  order_id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
  customer_id bigint NOT NULL,
  order_total numeric(10,2) NOT NULL,
  created_at timestamptz NOT NULL DEFAULT now()
);
INSERT INTO customer_orders (customer_id, order_total)
SELECT (random() * 1000)::bigint + 1, round((random() * 500 + 5)::numeric, 2)
FROM generate_series(1, 1000);
SELECT count(*) AS rows FROM customer_orders;

Restoring a Single Data Group

Taking a Snapshot and Restoring

First, I took a snapshot.

aws rds create-db-cluster-snapshot \
  --db-cluster-identifier dgv-c1 \
  --db-cluster-snapshot-identifier dgv-c1-snap1

After the snapshot became available, I deleted the rows in orders_a where customer_id was 500 or less.

DELETE FROM customer_orders WHERE customer_id <= 500;

Restoring from a snapshot creates a new cluster. I specified only the identifier of tenanta in --data-group-restore-configurations.

aws rds restore-db-cluster-from-snapshot \
  --db-cluster-identifier dgv-c2 \
  --snapshot-identifier dgv-c1-snap1 \
  --engine aurora-postgresql \
  --engine-version 19.0 \
  --storage-type aurora-iopt1 \
  --data-group-restore-configurations '[{"DataGroupIdentifier":"dg-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"}]'

Because the cluster immediately after restoration has no writer instance, I added one.

aws rds create-db-instance \
  --db-instance-identifier dgv-c2-i1 \
  --db-cluster-identifier dgv-c2 \
  --db-instance-class db.r8g.large \
  --engine aurora-postgresql

When the writer became available, tenanta in the restore destination was active.

Restore Results

I compared the row counts and the sum of order_total for orders_a and orders_b in dgv-c1 and orders_a in dgv-c2.

Point in time dgv-c1 orders_a dgv-c1 orders_b dgv-c2 orders_a
Before deletion 1,000 rows / 254291.05 1,000 rows / 251723.79 Not created
After deletion 493 rows / 127074.41 1,000 rows / 251723.79 Not created
After restore 493 rows / 127074.41 1,000 rows / 251723.79 1,000 rows / 254291.05

I checked the data group in the restore destination.

aws rds describe-data-groups \
  --db-cluster-identifier dgv-c2
{
    "DataGroups": [
        {
            "DBClusterIdentifier": "dgv-c2",
            "DataGroupName": "tenanta",
            "DataGroupIdentifier": "dg-a1b2c3d4-5678-90ab-cdef-EXAMPLE33333",
            "DataGroupArn": "arn:aws:rds-preview:us-east-2:111122223333:data-group:dg-a1b2c3d4-5678-90ab-cdef-EXAMPLE33333",
            "KmsKeyId": "arn:aws:kms:us-east-2:111122223333:key/1a2b3c4d-5e6f-7a8b-9c0d-EXAMPLE11111",
            "AdditionalEncryptionContext": {
                "tenant": "a"
            },
            "Status": "active",
            "TagList": [],
            "DataGroupCreateTime": "2026-12-02T18:48:57.215000+00:00",
            "StorageEncryptionType": "sse-kms"
        }
    ]
}

The restored tenanta was given a new identifier, and its key and encryption context are the same as those of the original tenanta. The field name for the KMS key is KmsKeyId. The output example in the user guide writes it as KMSKeyId.

When I connected to dgv-c2 and retrieved the list of data groups, only tenanta was displayed.

SELECT name FROM pg_catalog.aurora_datagroups ORDER BY 1;
  name   
---------
 tenanta
(1 row)

Summary

Each data group could be encrypted with a separate KMS key, and only a specific data group could be restored from a snapshot.

With data groups, restoration can now be operated per tenant while keeping a shared cluster.

If you maintain an Aurora cluster for each tenant for reasons such as encryption and managing them has become a challenge, please try this update in the preview environment.

Share this article

AWSのお困り事はクラスメソッドへ