

# Viewing and monitoring 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/).

You can monitor an Aurora PostgreSQL integration with Amazon S3 Tables in several ways: check the status of the integration, check the replication state of each table, view Amazon CloudWatch metrics, and subscribe to Amazon RDS events.

**Topics**
+ [Viewing an integration](#s3tables-integration.monitoring.viewing)
+ [Integration statuses](#s3tables-integration.monitoring.statuses)
+ [Table states](#s3tables-integration.monitoring.table-states)
+ [Per-table status](#s3tables-integration.monitoring.per-table-status)
+ [Metrics](#s3tables-integration.monitoring.metrics)
+ [Events](#s3tables-integration.monitoring.events)

## Viewing an integration
<a name="s3tables-integration.monitoring.viewing"></a>

You can view an integration and its status with the AWS Management Console, the AWS CLI, or the Amazon RDS API.

**To view 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**. The **Status** column shows the status of each integration.

1. Choose an integration name to view its details, including the source and target Amazon Resource Names (ARNs) and the creation date.

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

**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}}
```

The response includes the integration name and ARN, the source DB cluster ARN, the target table bucket ARN, the data rules, and the status.

To list every integration in the current AWS Region with only its name and status, use the `--query` option:

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

```
aws rds describe-integrations \
  --query "Integrations[].[IntegrationName,Status]" \
  --output table
```
For Windows:  

```
aws rds describe-integrations ^
  --query "Integrations[].[IntegrationName,Status]" ^
  --output table
```

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

## Integration statuses
<a name="s3tables-integration.monitoring.statuses"></a>

An integration has one of the following statuses. The Amazon RDS console shows each status in the **Status** column of the integrations list.


| Status | Description | 
| --- | --- | 
| creating | The integration is being created, and the initial full sync is running. The time it takes to reach the active status depends on the number and size of the source tables. | 
| active | Aurora is replicating data to the target. | 
| modifying | Aurora is applying a change that you made to the integration. | 
| syncing | Aurora is reloading data for some or all tables. You requested a resync, or Aurora started one to recover from an error or a data definition language (DDL) change. For more information, see [Resyncing integrations with Amazon S3 Tables](s3tables-integration.resyncing.md). | 
| needs\_attention | The integration needs an action from you, for example restoring the integration's access to the target table bucket or to a AWS Key Management Service (AWS KMS) key. After you fix the cause, resync the integration. | 
| failed | The integration encountered an error that it cannot recover from. You must delete the integration and create it again. | 
| deleting | The integration is being deleted. | 

An integration enters the `needs_attention` status when it cannot continue until you fix a problem in your account. For example:
+ The integration lost access to the target table bucket, for example because the bucket policy changed (RDS-EVENT-0589).
+ The integration lost access to an AWS KMS key (RDS-EVENT-0588).
+ A resync of one or more tables could not complete.

To recover, fix the cause, and then resync the integration. To find the affected tables, see [Per-table status](#s3tables-integration.monitoring.per-table-status). For resync instructions, see [Resyncing tables manually](s3tables-integration.resyncing.md#s3tables-integration.resyncing.manual).

An integration enters the `failed` status when it encounters an error that it cannot recover from. The following can cause this status:
+ All of the integration's grants on its AWS KMS key are revoked. For more information, see [Customer managed key for the integration](s3tables-integration.security.md#s3tables-integration.security.integration-key).
+ A key policy denies the integration permission to use the customer managed AWS KMS key that encrypts the target table bucket. For more information, see [Customer managed key for the target table bucket](s3tables-integration.security.md#s3tables-integration.security.bucket-key).
+ A resync fails in a way that stops replication. Aurora sends RDS-EVENT-0587 with the message "The integration failed during resynchronization and can no longer replicate data."

To recover, delete the integration and create a new one. For more information, see [Recreating an integration](s3tables-integration.deleting.md#s3tables-integration.deleting.recreate).

## Table states
<a name="s3tables-integration.monitoring.table-states"></a>

Each replicated table has its own replication state, separate from the integration status. An integration can be `active` while a table is `FAILED`. A table can be in one of the following states.


| State | Description | 
| --- | --- | 
| SYNCED | The table is replicating and is up to date. | 
| RESYNC\_REQUIRED | A resync of the table is pending. Either the integration determined that the table needs a resync or you requested one, and the resync has not started yet. | 
| RESYNC\_INITIATED | A resync of the table has started. For more information, see [Automatic resync](s3tables-integration.resyncing.md#s3tables-integration.resyncing.automatic). | 
| RESYNC\_REPLAYING | The table's data was reloaded, and the changes made during the reload are being applied. | 
| FAILED | The table cannot be replicated, for example because its primary key was dropped. The cause appears in the status\_reason column of the status table. Fix the cause, and then take the action listed for that status\_reason value in [Per-table status](#s3tables-integration.monitoring.per-table-status). After some fixes, the integration syncs the table automatically. After others, you must resync the table. | 

**Note**  
If you drop a source table or remove a table from the data rules, the table's row is removed from the status table (described in [Per-table status](#s3tables-integration.monitoring.per-table-status)). If you delete a target table directly in the table bucket instead of through the integration, the table enters the `FAILED` state with the reason `TARGET_TABLE_DELETED`. The other tables in the integration keep replicating.

## Per-table status
<a name="s3tables-integration.monitoring.per-table-status"></a>

Aurora keeps a status table in the target table bucket that records the replication state of each table. The console provides sample queries that you can run with Amazon Athena or with your preferred query engine. Before you query, turn on integration with AWS analytics services in the Region of the target table bucket. For instructions, see [Turning on integration with AWS analytics services](zero-etl.setting-up.md#s3tables-integration.setting-up.analytics).

If the table bucket is in another account, the status table is in that account, and the source account cannot query it. Run the status queries from the table bucket owner's account. For more information, see [Using a table bucket in another account](zero-etl.setting-up.md#s3tables-integration.setting-up.cross-account).

**To run a status query from the console**

1. Open the integration details page in the Amazon RDS console, as described in [Viewing an integration](#s3tables-integration.monitoring.viewing).

1. Choose the **Table status** tab.

1. Choose a query from the **Choose a query** list.

1. Choose **Run query in Athena**.

   The Athena console opens with the query, catalog, and database already selected.

You can also copy a query and run it in any compatible engine.

The status table is named `integration_table_status_{{integration_id}}`, where {{integration\_id}} is the integration ID (the last part of the integration ARN, for example 5b9f3d2e-1111-2222-3333-444455556666) with its hyphens replaced by underscores. It is in the `integrations_metadata` namespace of the target Amazon S3 Tables catalog. It has the following eight columns, in order.


| Column | Description | 
| --- | --- | 
| source\_table\_name | The source table, in the form database.schema.table. Each name appears as it is in the source database, with its case and any hyphens kept. A period or backslash within a name is preceded by a backslash. | 
| schema\_version | The version of the status table schema. | 
| target\_table\_name | The name of the target Apache Iceberg table, in the form namespace.table. | 
| target\_table\_arn | The ARN of the target Iceberg table. | 
| target\_table\_current\_state | The current replication state of the table. The values are uppercase: SYNCED, RESYNC\_REQUIRED, RESYNC\_INITIATED, RESYNC\_REPLAYING, FAILED. | 
| status\_reason | Why the table is in the FAILED state, as an uppercase reason code such as SOURCE\_TABLE\_MISSING\_PRIMARY\_KEY, SOURCE\_UNSUPPORTED\_TYPE, or TARGET\_ACCESS\_DENIED. | 
| last\_modified\_time | When the state last changed. | 
| status\_detail | A sentence that explains the status\_reason value and, where possible, the remedy. It is empty when the table is healthy. It can be missing on integrations created before this column was added. Treat it as advisory text, and use status\_reason when you make decisions. | 

The following table lists the `status_reason` values that a `FAILED` table can show, and what to do about each one. For worked examples, see [A table is not being replicated](s3tables-integration.troubleshooting.md#s3tables-integration.troubleshooting.table).


| `status_reason` | What to do | 
| --- | --- | 
| SOURCE\_TABLE\_MISSING\_PRIMARY\_KEY | Add a primary key to the source table. The integration then syncs the table. | 
| SOURCE\_PK\_FILTERED | Change the data rules so that they include the primary key columns. If a key column holds sensitive data, do not include it. A table cannot replicate while a data rule excludes part of its primary key. Instead, define a primary key on non-sensitive columns at the source, or exclude the table. | 
| SOURCE\_UNSUPPORTED\_TYPE | Exclude the column with a data rule, or change its type at the source, and then resync the table. | 
| SOURCE\_UNSUPPORTED\_VALUE, SOURCE\_UNSUPPORTED\_PK\_VALUE | Correct the value at the source, and then resync the table. | 
| SOURCE\_UNSUPPORTED\_TABLE\_TYPE | The table type is not supported, for example a partitioned or unlogged table. For more information, see [Aurora PostgreSQL table limitations](zero-etl.reqs-lims.md#s3tables-integration.limitations.tables). | 
| SOURCE\_UNSUPPORTED\_TABLE\_NAME | Rename the table to a supported name, and then resync the table. | 
| SOURCE\_UNSUPPORTED\_COLUMN\_NAME | Rename the column to a supported name, and then resync the table. | 
| TARGET\_NAME\_COLLISION | Another table already uses the target name. Rename one of the source tables, or exclude one of them with a data rule. | 
| TARGET\_ACCESS\_DENIED | Fix the table bucket resource policy, and then resync the table. For the policy, see [Creating the table bucket and resource policy](zero-etl.setting-up.md#s3tables-integration.setting-up.bucket-policy). | 
| TARGET\_TABLE\_DELETED | The target table was deleted outside the integration. Resync the table. | 
| TARGET\_TABLE\_IN\_USE | A table with the same name already exists in the target. This can happen when you recreate an integration. For more information, see [Recreating an integration](s3tables-integration.deleting.md#s3tables-integration.deleting.recreate). | 
| DDL\_APPLY\_FAILED | Correct the schema change at the source, and then resync the table. | 
| RESYNC\_PERMANENTLY\_REJECTED | Automatic resyncs kept failing. Fix the cause, and then resync the integration. | 
| SOURCE\_ERROR\_UNRECOGNIZED | Check the source table and its status\_detail, and then resync the table. | 
| INTERNAL\_ERROR | The failure was caused by an internal error, not by the table or its data. Contact AWS Support. | 

To list every table, with the most recently changed first, run the following query:

```sql
SELECT source_table_name,
       target_table_name,
       target_table_arn,
       target_table_current_state,
       status_reason,
       last_modified_time,
       status_detail
FROM "s3tablescatalog/{{my-table-bucket}}"."integrations_metadata"."integration_table_status_{{5b9f3d2e_1111_2222_3333_444455556666}}"
ORDER BY last_modified_time DESC;
```

To find only the tables that need attention, filter on the state:

```sql
SELECT source_table_name, status_reason, status_detail
FROM "s3tablescatalog/{{my-table-bucket}}"."integrations_metadata"."integration_table_status_{{5b9f3d2e_1111_2222_3333_444455556666}}"
WHERE target_table_current_state = 'FAILED';
```

**Note**  
When you delete an integration, its status table remains in the target table bucket. You can delete it yourself. For more information, see [Removing the source and target resources](s3tables-integration.deleting.md#s3tables-integration.deleting.cleanup).

## Metrics
<a name="s3tables-integration.monitoring.metrics"></a>

You can view integration metrics on the **Metrics** tab of the integration details page in the Amazon RDS console, or in Amazon CloudWatch. On the **Metrics** tab, you can change the time range (1 hour, 3 hours, 12 hours, 1 day, 3 days, or a custom range) and switch between UTC and your local time zone. To track how far the target is behind the source, use the `ReplicationLag` metric.

In CloudWatch, the metrics are in the `AWS/RDS/ZETL` namespace, even though this integration is not a zero-ETL integration. Each metric has the dimension `IntegrationId`. If your table bucket is in another account, the metrics are in the account that owns the source DB cluster, not in the table bucket owner's account.

The following table lists the metrics.


| Metric (console name) | CloudWatch metric name | Statistic and unit | Description | 
| --- | --- | --- | --- | 
| Replication lag | ReplicationLag | Maximum, seconds | How far the target is behind the source, as a time delay. | 
| Bytes processed | BytesProcessed | Sum, bytes | The volume of data processed from the source since integration creation. | 
| Rows inserted | InsertCount | Sum, count | The number of insert events applied to the target. | 
| Rows updated | UpdateCount | Sum, count | The number of update events applied to the target. | 
| Rows deleted | DeleteCount | Sum, count | The number of delete events applied to the target. | 
| DDL statements applied | DdlCount | Sum, count | The number of schema changes applied to the target. | 
| Integration health | IntegrationHealthy | Minimum, 0 or 1 | The overall health of the integration. | 
| Tables replicating | TablesReplicating | Maximum, count | The number of tables that are replicating. | 
| Tables with errors | TablesErrored | Maximum, count | The number of tables in an error state. | 
| Tables dropped | TablesDropped | Maximum, count | The number of tables dropped from replication. | 

A healthy integration has an `IntegrationHealthy` value of 1 and a `TablesErrored` value of 0, and its `ReplicationLag` is not growing over time. If `TablesErrored` is greater than 0, find the failed tables as described in [Per-table status](#s3tables-integration.monitoring.per-table-status). If `ReplicationLag` keeps growing, see [Data is missing or delayed](s3tables-integration.troubleshooting.md#s3tables-integration.troubleshooting.delayed).

## Events
<a name="s3tables-integration.monitoring.events"></a>

Aurora sends Amazon RDS events for the integration. Events are delivered through RDS event subscriptions, and you can send them to a target such as an Amazon Simple Notification Service (Amazon SNS) topic. To receive these events, create an event subscription with the source type `integration-s3tables`. If your table bucket is in another account, create the subscription in the account that owns the source DB cluster.

Aurora sends events for integration lifecycle changes (`creating`, `active`, `modifying`, and `deleting`), for resyncs (started, completed, and failed), and for table problems. The table problem events are the following:
+ One or more tables failed (RDS-EVENT-0590).
+ Tables were excluded from replication (RDS-EVENT-0591).
+ The target became inaccessible, for example because the bucket policy changed (RDS-EVENT-0589).
+ The integration cannot use an AWS KMS key (RDS-EVENT-0588).

The following table lists the resync events.


| Event | ID | Message | 
| --- | --- | --- | 
| Resync started | RDS-EVENT-0585 | Varies by scope and who started the resync. See the RDS-EVENT-0585 table that follows. | 
| Resync completed | RDS-EVENT-0586 | Your integration with Amazon S3 Tables finished resynchronizing and is replicating data. | 
| Resync failed | RDS-EVENT-0587 | Varies by cause. See the RDS-EVENT-0587 table that follows. | 

When a resync starts, the RDS-EVENT-0585 message names the scope of the resync (full or partial) and who started it, as shown in the following table.


| Scope | Started by | Message | 
| --- | --- | --- | 
| Full | You | Full resynchronization of the integration with S3 Tables initiated at your request. | 
| Selected tables | You | Resynchronization of selected tables in the integration with S3 Tables initiated at your request. | 
| Full | Amazon RDS | Full resynchronization of the integration with S3 Tables initiated by Amazon RDS. | 
| Selected tables | Amazon RDS | Resynchronization of selected tables in the integration with S3 Tables initiated by Amazon RDS. | 

Amazon RDS starts a resync on its own to recover from an error or to apply a DDL change. For more information, see [Automatic resync](s3tables-integration.resyncing.md#s3tables-integration.resyncing.automatic).

When a resync fails, the RDS-EVENT-0587 message gives the reason, as shown in the following table.


| Cause | Message | 
| --- | --- | 
| Timed out | The resynchronization of the integration timed out. Resynchronize the integration, and contact AWS Support if the problem persists. | 
| Could not start | Unable to start the resynchronization of the integration. Contact AWS Support. | 
| Replication failed | The integration failed during resynchronization and can no longer replicate data. Delete the integration and create it again, and contact AWS Support if the problem persists. | 

The failure message is also shown as the integration's error message in `DescribeIntegrations`.

Table events are grouped. Changes within about 10 seconds are sent as one event. The event for failed tables (RDS-EVENT-0590) names the tables. The event for tables that were excluded from replication (RDS-EVENT-0591) gives only the number of tables. Table events are best effort, so use the status table as the record of each table's state.