

# Resyncing 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/).

In an Aurora PostgreSQL integration with Amazon S3 Tables, a resync reloads a table's data from the source when ongoing replication cannot continue correctly. During the resync, the existing data in the target remains available to query but is not updated. When the resync completes, replication resumes.

A full resync reloads every table that the integration includes. A partial resync reloads only the tables that you name with the `--tables` option of the `resync-integration` command.

**Topics**
+ [Automatic resync](#s3tables-integration.resyncing.automatic)
+ [Resyncing tables manually](#s3tables-integration.resyncing.manual)

## Automatic resync
<a name="s3tables-integration.resyncing.automatic"></a>

When a recoverable error stops a table from replicating, or a data definition language (DDL) change requires a resync, the integration resyncs the table automatically. No action is required. For the DDL changes that require a resync, see [Changes that cause a resync](s3tables-integration.schema-changes.md#s3tables-integration.schema-changes.resync).

During an automatic resync, the table moves through the following states:

1. The table enters `RESYNC_REQUIRED` when the integration detects that it needs a resync.

1. The table changes to `RESYNC_INITIATED` when the reload from the source starts.

1. The table changes to `RESYNC_REPLAYING` while the integration applies source changes that were made during the reload to the target table.

1. The table returns to `SYNCED` when the resync completes.

For a description of each state, see [Table states](s3tables-integration.monitoring.md#s3tables-integration.monitoring.table-states).

If automatic resyncs fail three times, the table enters the `FAILED` state with the reason `RESYNC_PERMANENTLY_REJECTED`. For more information, see [A table is not being replicated](s3tables-integration.troubleshooting.md#s3tables-integration.troubleshooting.table).

The integration starts an automatic resync for the following common reasons:
+ A DDL change that requires a resync. For the list, see [Changes that cause a resync](s3tables-integration.schema-changes.md#s3tables-integration.schema-changes.resync).
+ An increase in the scope of the data rules.
+ A table rename that makes the table match your data rules.
+ A column rename that makes a data rule stop excluding the column.
+ Recovery from an internal error.

If the integration detects that a table's target might no longer match the source, it resyncs the table. For example, this can happen after a failed write to the target or an error in the change stream.

## Resyncing tables manually
<a name="s3tables-integration.resyncing.manual"></a>

You can resync tables manually with the console, the AWS CLI, or the Amazon RDS API. The console always resyncs every table in the integration. To resync only selected tables, use the AWS CLI or the Amazon RDS API.

You can start a resync when the integration's status is `active` or `needs_attention`. You cannot resync an integration when its status is `syncing`, `creating`, `modifying`, `deleting`, or `failed`.

While a resync is running, a new resync request is refused until the running resync completes. Wait for the status to return to `active`, and then start the next resync.

A resync pauses replication for the affected tables and reloads their data from the source. The existing data in the target tables remains available to query during the resync. The time to complete the resync depends on the size of the tables. While the resync runs, the integration's status is `syncing`.

**To resync 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**, and then choose your integration.

1. Choose **Resync**.

1. In the **Resync integration** dialog, enter `confirm`, and then choose **Resync**.

To resync with the AWS CLI, use the `resync-integration` command. Use one of the following options:
+ `--tables`: Resyncs specific tables. Pass each table as `database.schema.table`. Each entry can also be `database.schema.*` or `database.*.*`. Pass 1 to 100 entries. The integration's data rules must include each one. On Linux, macOS, or Unix, put an entry that contains `*` in single quotes, for example `--tables '{{sales.public.*}}'`.
+ `--full-resync`: Resyncs every table in the integration.

You cannot use `--full-resync` and `--tables` in the same command.

The following example resyncs two tables:

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

```
aws rds resync-integration \
  --integration-identifier arn:aws:rds:{{us-east-1}}:{{111122223333}}:integration:{{5b9f3d2e-1111-2222-3333-444455556666}} \
  --tables {{sales.public.orders}} {{sales.public.customers}}
```
For Windows:  

```
aws rds resync-integration ^
  --integration-identifier arn:aws:rds:{{us-east-1}}:{{111122223333}}:integration:{{5b9f3d2e-1111-2222-3333-444455556666}} ^
  --tables {{sales.public.orders}} {{sales.public.customers}}
```

The following example resyncs the whole integration:

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

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

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

After you start a resync, the integration status changes to `syncing`, and Aurora sends RDS-EVENT-0585 (resync started). When the resync completes, Aurora sends RDS-EVENT-0586 (resync completed), the integration status returns to `active`, and the integration resumes replication. A resync that you start while the integration is in `needs_attention` also returns it to `active`. To follow each table, check its state in the per-table status. For more information, see [Per-table status](s3tables-integration.monitoring.md#s3tables-integration.monitoring.per-table-status) and [Events](s3tables-integration.monitoring.md#s3tables-integration.monitoring.events).