

# Deleting 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 delete an Aurora PostgreSQL integration with Amazon S3 Tables, replication stops and the deletion cannot be undone. Note that:
+ The data in the source DB cluster is not deleted.
+ The target tables and their data stay in the table bucket, but they no longer receive new data.
+ You can delete an integration in any status.

You can delete an integration with the AWS Management Console, the AWS CLI, or the RDS API.

**Topics**
+ [Deleting an integration](#s3tables-integration.deleting.delete)
+ [Recreating an integration](#s3tables-integration.deleting.recreate)
+ [Removing the source and target resources](#s3tables-integration.deleting.cleanup)

## Deleting an integration
<a name="s3tables-integration.deleting.delete"></a>

**To delete an integration in the console**

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 the integration that you want to delete, and then choose **Delete**.

1. In the confirmation dialog, enter `confirm`, and then choose **Delete**.

While Aurora deletes the integration, its status is `deleting`. For more information, see [Integration statuses](s3tables-integration.monitoring.md#s3tables-integration.monitoring.statuses).

To delete an integration with the AWS CLI, use the [delete-integration](https://docs.aws.amazon.com/cli/latest/reference/rds/delete-integration.html) command and specify the `--integration-identifier` option.

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

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

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

To verify that the integration was deleted, run the `describe-integrations` command. While Aurora deletes the integration, its status is `deleting`. When the deletion finishes, the integration no longer appears in the output, and describing it by its ARN fails. For more information, see [Viewing an integration](s3tables-integration.monitoring.md#s3tables-integration.monitoring.viewing).

To delete an integration with the Amazon RDS API, use the [`DeleteIntegration`](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DeleteIntegration.html) operation with the `IntegrationIdentifier` parameter.

## Recreating an integration
<a name="s3tables-integration.deleting.recreate"></a>

To replicate a different set of data, or to recover from a problem that a resync cannot fix, delete the integration and create a new one. For instructions, see [Creating integrations with Amazon S3 Tables](s3tables-integration.creating.md).

After the delete finishes, you can create a new integration with the same table bucket, but a different `TargetPrefix`. An integration in the `failed` status keeps its prefix until you delete it. If tables with the same names already exist in the target, the new integration can fail those tables with the reason `TARGET_TABLE_IN_USE`.

For the `TargetPrefix` rules, see [Data rules for integrations with Amazon S3 Tables](s3tables-integration.data-rules.md).

## Removing the source and target resources
<a name="s3tables-integration.deleting.cleanup"></a>

Deleting the integration does not delete the source DB cluster or the target table bucket. If you no longer need them, remove them separately:
+ Delete the source DB instances and DB cluster. For more information, see [Deleting Aurora DB clusters and DB instances](USER_DeleteCluster.md).
+ Delete the target tables and namespaces, including the `integrations_metadata` namespace. That namespace holds the integration's status table, which is named `integration_table_status_` followed by the integration ID. Then delete the target table bucket if you no longer need it. A table bucket must be empty before you can delete it.

If you keep the source DB cluster, its replication parameters stay set. You do not have to turn off enhanced logical replication. If you do turn it off, set `aurora.logical_replication_backup` and `aurora.logical_replication_globaldb` to `1` first, and then reboot the primary DB instance. Turning off `aurora.enhanced_logical_replication` invalidates all logical replication slots on the primary DB instance, so any other logical replication from this DB cluster stops until you recreate its slots. For more information, see [Step 1: Create a custom DB cluster parameter group](zero-etl.setting-up.md#zero-etl.parameters).

If other integrations write to the same table bucket, keep the namespaces and tables that they use, and do not delete the table bucket.

To find every table in a namespace, run the `list-tables` command. Delete each table that it lists before you delete the namespace.

```
aws s3tables list-tables --table-bucket-arn arn:aws:s3tables:{{us-east-1}}:{{111122223333}}:bucket/{{my-table-bucket}} --namespace {{my_prefix_sales}}
```

**Warning**  
Deleting a table, a namespace, or a table bucket permanently deletes its data and cannot be undone. For guidance on which principals should have permissions to delete these resources, see [Namespace-level access control and Lake Formation](s3tables-integration.security.md#s3tables-integration.security.namespaces).

The following example deletes the target table `public_orders`, the status table, their namespaces, and the table bucket. Delete each table, then each namespace, and then the table bucket. The status table is named `integration_table_status_` followed by the integration ID, with its hyphens replaced by underscores. If the table bucket is in another account, run these `s3tables` commands in that account.

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

```
aws s3tables delete-table \
  --table-bucket-arn arn:aws:s3tables:{{us-east-1}}:{{111122223333}}:bucket/{{my-table-bucket}} \
  --namespace {{my_prefix_sales}} \
  --name {{public_orders}}

aws s3tables delete-table \
  --table-bucket-arn arn:aws:s3tables:{{us-east-1}}:{{111122223333}}:bucket/{{my-table-bucket}} \
  --namespace integrations_metadata \
  --name integration_table_status_{{5b9f3d2e_1111_2222_3333_444455556666}}

aws s3tables delete-namespace \
  --table-bucket-arn arn:aws:s3tables:{{us-east-1}}:{{111122223333}}:bucket/{{my-table-bucket}} \
  --namespace {{my_prefix_sales}}

aws s3tables delete-namespace \
  --table-bucket-arn arn:aws:s3tables:{{us-east-1}}:{{111122223333}}:bucket/{{my-table-bucket}} \
  --namespace integrations_metadata

aws s3tables delete-table-bucket \
  --table-bucket-arn arn:aws:s3tables:{{us-east-1}}:{{111122223333}}:bucket/{{my-table-bucket}}
```
For Windows:  

```
aws s3tables delete-table ^
  --table-bucket-arn arn:aws:s3tables:{{us-east-1}}:{{111122223333}}:bucket/{{my-table-bucket}} ^
  --namespace {{my_prefix_sales}} ^
  --name {{public_orders}}

aws s3tables delete-table ^
  --table-bucket-arn arn:aws:s3tables:{{us-east-1}}:{{111122223333}}:bucket/{{my-table-bucket}} ^
  --namespace integrations_metadata ^
  --name integration_table_status_{{5b9f3d2e_1111_2222_3333_444455556666}}

aws s3tables delete-namespace ^
  --table-bucket-arn arn:aws:s3tables:{{us-east-1}}:{{111122223333}}:bucket/{{my-table-bucket}} ^
  --namespace {{my_prefix_sales}}

aws s3tables delete-namespace ^
  --table-bucket-arn arn:aws:s3tables:{{us-east-1}}:{{111122223333}}:bucket/{{my-table-bucket}} ^
  --namespace integrations_metadata

aws s3tables delete-table-bucket ^
  --table-bucket-arn arn:aws:s3tables:{{us-east-1}}:{{111122223333}}:bucket/{{my-table-bucket}}
```