

# Creating integrations with Amazon S3 Tables

**Important**  
This is preview documentation for the Aurora PostgreSQL integration with Amazon S3 Tables. Before using this capability, review the Betas and Previews terms in the [AWS Service Terms](https://aws.amazon.com/service-terms/).

When you create an Aurora PostgreSQL integration with Amazon S3 Tables, you specify the source Aurora DB cluster and the target Amazon S3 Tables table bucket. You also specify data rules that choose the data to replicate and set the target prefix, which the integration uses to name the namespaces it creates in the table bucket. Optionally, you can choose a customer managed key for encryption and add tags. Aurora creates the integration, runs the initial full sync, and then replicates changes from the source DB cluster to the target table bucket.

This page describes how to create an integration with the AWS Management Console and the AWS CLI. You can also use the [`CreateIntegration`](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateIntegration.html) operation of the Amazon RDS API.

**Topics**
+ [Prerequisites](#s3tables-integration.creating.prereqs)
+ [Required permissions](#s3tables-integration.creating.permissions)
+ [Creating an integration with the console](#s3tables-integration.creating.console)
+ [Creating an integration with the AWS CLI](#s3tables-integration.creating.cli)
+ [Encrypting the integration with a customer managed key](#s3tables-integration.creating.encryption)
+ [Monitoring creation progress](#s3tables-integration.creating.progress)
+ [Next steps](#s3tables-integration.creating.next)

## Prerequisites
<a name="s3tables-integration.creating.prereqs"></a>

Before you create an integration, set up a source Aurora DB cluster and a target table bucket with a resource policy. For instructions, see [Getting started with Aurora zero-ETL integrations](zero-etl.setting-up.md) and [Step 3c: Create a target Amazon S3 Tables table bucket](zero-etl.setting-up.md#s3tables-integration.setting-up).

A source table must have a primary key to replicate. To find the tables that do not have one, see the query in [Adding data to the source DB cluster](s3tables-integration.querying.md#s3tables-integration.querying.add-data).

## Required permissions
<a name="s3tables-integration.creating.permissions"></a>

The IAM principal (user or role) that creates an integration with Amazon S3 Tables needs the following AWS Identity and Access Management (IAM) permissions:
+ Permission to create the integration, for example `rds:CreateIntegration`.
+ The `s3tables:GetTableBucket`, `s3tables:CreateNamespace`, and `s3tables:DeleteNamespace` permissions on the target table bucket. For a table bucket in another account, see [Using a table bucket in another account](zero-etl.setting-up.md#s3tables-integration.setting-up.cross-account).
+ If the source DB cluster or the integration uses a customer managed AWS Key Management Service (AWS KMS) key, permissions on the key, including `kms:DescribeKey`, `kms:Decrypt`, and `kms:CreateGrant`. For the key policies, see [Data protection and encryption](s3tables-integration.security.md#s3tables-integration.security.encryption).

## Creating an integration with the console
<a name="s3tables-integration.creating.console"></a>

Use the following procedure to create an integration in the Amazon RDS console.

**To create an integration with Amazon S3 Tables**

1. Sign in to the AWS Management Console and open the Amazon RDS console at [https://console.aws.amazon.com/rds/](https://console.aws.amazon.com/rds/).

1. In the navigation pane, choose **Integrations**.

1. Choose **Create integration**, and then choose **Integrate with S3 Tables**.

1. For **Integration identifier**, enter a name. The name must be unique across the integrations in your account in the current Region. It can have 1 to 63 alphanumeric characters or hyphens, and the first character must be a letter. It cannot end with a hyphen or contain two consecutive hyphens.

1. Under **Source**, for **Source database**, choose the source Aurora DB cluster. To choose from a list, choose **Browse databases**.

   If the DB cluster parameters are not set for replication, the console asks you to update the parameter group and reboot before you continue. For the required parameters, see [Step 1: Create a custom DB cluster parameter group](zero-etl.setting-up.md#zero-etl.parameters).

1. Under **Destination**, for **S3 table bucket**, choose an existing table bucket, or choose **Create new S3 table bucket**. To use a table bucket in another account, choose **Specify a different account for the destination resource**.

   For the setup that a table bucket in another account needs, see [Using a table bucket in another account](zero-etl.setting-up.md#s3tables-integration.setting-up.cross-account).

1. Under **Data rules**, choose which data to replicate and set the target prefix. Use the **Visual** editor to choose a template and set rules, or choose **JSON** to enter the rules directly.

   The first rule sets the target prefix, and the second rule selects the databases, schemas, and tables to replicate. The default template replicates all databases and tables. For the syntax, see [Data rules for integrations with Amazon S3 Tables](s3tables-integration.data-rules.md).

1. (Optional) Under **Encryption**, the integration uses an AWS owned key by default. To use a customer managed AWS KMS key, choose **Customize encryption settings**, and then choose the key. For more information, see [Encrypting the integration with a customer managed key](#s3tables-integration.creating.encryption).

1. (Optional) Under **Tags**, choose **Add new tag**, and then enter a key and value.

1. Choose **Create integration**.

   If creation fails, see [I cannot create an integration with Amazon S3 Tables](s3tables-integration.troubleshooting.md#s3tables-integration.troubleshooting.create).

To confirm that the integration is created, see [Monitoring creation progress](#s3tables-integration.creating.progress).

## Creating an integration with the AWS CLI
<a name="s3tables-integration.creating.cli"></a>

To create an integration with the AWS CLI, use the [create-integration](https://docs.aws.amazon.com/cli/latest/reference/rds/create-integration.html) command. Specify an integration name, the Amazon Resource Name (ARN) of the source Aurora DB cluster, the ARN of the target table bucket, and data rules that choose the data to replicate and set the target prefix.

**Example**  
For Linux, macOS, or Unix:  

```
aws rds create-integration \
  --integration-name {{my-s3tables-integration}} \
  --source-arn arn:aws:rds:{{us-east-1}}:{{111122223333}}:cluster:{{my-source-cluster}} \
  --target-arn arn:aws:s3tables:{{us-east-1}}:{{111122223333}}:bucket/{{my-table-bucket}} \
  --data-rules '[{"Database":"*","Schema":"*","Table":"*","Properties":{"TargetPrefix":"{{my_prefix}}"}}]'
```
For Windows:  
Save the JSON array from the `--data-rules` value in the preceding example (without the surrounding single quotes) to a file named `data-rules.json`, replace {{my\_prefix}} with your prefix, and then run the following command from the folder that contains the file.  

```
aws rds create-integration ^
  --integration-name {{my-s3tables-integration}} ^
  --source-arn arn:aws:rds:{{us-east-1}}:{{111122223333}}:cluster:{{my-source-cluster}} ^
  --target-arn arn:aws:s3tables:{{us-east-1}}:{{111122223333}}:bucket/{{my-table-bucket}} ^
  --data-rules file://data-rules.json
```

The command has the following required options:
+ `--integration-name`: A name for the integration. It must be unique across the integrations in your account in the current Region. The name appears in the console and in the `describe-integrations` output. To describe, modify, resync, or delete the integration, use the integration ARN or ID, not its name. The `create-integration` command returns the ARN in the `IntegrationArn` field of its output.
+ `--source-arn`: The ARN of the source Aurora DB cluster.
+ `--target-arn`: The ARN of the target table bucket. For the Region requirement, see [Limitations for integrations with Amazon S3 Tables](zero-etl.reqs-lims.md#s3tables-integration.limitations).
+ `--data-rules`: The data rules that choose what to replicate and set the target prefix, passed as a JSON string. Every integration must set a `TargetPrefix`, which names the namespaces that it creates. Each integration that writes to the same table bucket must use a different prefix. The example replicates everything with the prefix `my_prefix`. To avoid shell quoting problems, pass the rules as a well-formed JSON string or read them from a file. For the syntax, see [Data rules for integrations with Amazon S3 Tables](s3tables-integration.data-rules.md).

You can also use the following options:
+ `--kms-key-id`: The AWS KMS key that encrypts the integration. If you omit it, RDS uses an AWS owned key. For more information, see [Encrypting the integration with a customer managed key](#s3tables-integration.creating.encryption).
+ `--additional-encryption-context`: Non-secret key-value pairs that add context for the encryption key. You can use it only with `--kms-key-id`.
+ `--description`: A description of the integration.
+ `--tags`: Tags to apply to the integration.

To confirm that the integration is created, see [Monitoring creation progress](#s3tables-integration.creating.progress).

## Encrypting the integration with a customer managed key
<a name="s3tables-integration.creating.encryption"></a>

By default, RDS encrypts the integration with an AWS owned key. To use a customer managed AWS KMS key instead, specify it with `--kms-key-id` when you create the integration, or choose it in the console. To add encryption context, use `--additional-encryption-context`, which you can use only with `--kms-key-id`. For example: `--kms-key-id arn:aws:kms:{{us-east-1}}:{{111122223333}}:key/{{key-id}} --additional-encryption-context {{department}}={{analytics}}`.

The source DB cluster and the target table bucket can also use customer managed keys. As a result, up to three keys can be involved: the source DB cluster key, the integration key, and the table bucket key. For the key policy that each key needs, see [Data protection and encryption](s3tables-integration.security.md#s3tables-integration.security.encryption).

## Monitoring creation progress
<a name="s3tables-integration.creating.progress"></a>

While Aurora sets up the integration, its status is `creating`. When the initial full sync completes and the integration is ready to replicate, the status changes to `active`.

To check the status with the AWS CLI, use the `describe-integrations` command.

**Example**  
For Linux, macOS, or Unix:  

```
aws rds describe-integrations \
  --integration-identifier arn:aws:rds:{{us-east-1}}:{{111122223333}}:integration:{{5b9f3d2e-1111-2222-3333-444455556666}}
```
For Windows:  

```
aws rds describe-integrations ^
  --integration-identifier arn:aws:rds:{{us-east-1}}:{{111122223333}}:integration:{{5b9f3d2e-1111-2222-3333-444455556666}}
```

To check the status in the RDS console, choose **Integrations** in the navigation pane, and check the **Status** column for your integration.

For more information, see [Viewing an integration](s3tables-integration.monitoring.md#s3tables-integration.monitoring.viewing) and [Integration statuses](s3tables-integration.monitoring.md#s3tables-integration.monitoring.statuses).

## Next steps
<a name="s3tables-integration.creating.next"></a>

After the integration has a status of `active`, add data to the source DB cluster and query it in the target table bucket. For instructions, see [Adding data to a source Aurora DB cluster and querying it in Amazon S3 Tables](s3tables-integration.querying.md).