

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 開啟 Aurora PostgreSQL Limitless Database 的 Database Insights 進階模式
<a name="limitless-monitoring.cwdbi.advanced"></a>

若要為 Aurora PostgreSQL Limitless Database 開啟 Database Insights 的進階模式，請使用下列程序。

## 為 Aurora PostgreSQL Limitless Database 建立資料庫叢集時，開啟 Database Insights 的進階模式
<a name="limitless-monitoring.cwdbi.advancedcreate"></a>

為 Aurora PostgreSQL Limitless Database 建立資料庫時，開啟 Database Insights 的進階模式。

------
#### [ Console ]

在此主控台中，您可以在建立資料庫叢集時開啟 Database Insights 的進階模式。Database Insights 的設定適用於資料庫叢集中的所有資料庫執行個體。

**使用主控台建立資料庫叢集時，開啟 Database Insights 的進階模式**

1. 登入 AWS 管理主控台，開啟位於 [https://console.aws.amazon.com/rds/](https://console.aws.amazon.com/rds/) 的 Amazon RDS 主控台。

1. 選擇 **Databases** (資料庫)。

1. 選擇**建立資料庫**。

1. 在 **Database Insights** 區段中，選取**進階模式**。然後選擇下列選項：
   + **Retention (保留)** – 保留 Performance Insights 資料的時間。Database Insights 進階模式的保留期間必須為 15-24 個月。
   + **AWS KMS key** – 指定您的 KMS 金鑰。績效詳情使用您的 KMS 金鑰來加密所有可能的敏感資料。將會對傳輸中與靜態資料進行加密。如需更多詳細資訊，請參閱 [加密 Amazon Aurora 資源](Overview.Encryption.md)。

1. 選擇**建立資料庫**。

------
#### [ AWS CLI ]

若要在建立資料庫叢集時開啟 Database Insights 的進階模式，請呼叫 [create-db-cluster](https://docs.aws.amazon.com/cli/latest/reference/rds/create-db-cluster.html) AWS CLI 命令並提供下列值：
+ `--db-cluster-identifier`：資料庫叢集的識別符。
+ `--database-insights-mode advanced` 以開啟 Database Insights 的進階模式。
+ `--engine`：資料庫叢集必須使用 `aurora-postgresql` 資料庫引擎。
+ `--engine-version`：資料庫叢集必須使用其中一個資料庫引擎版本：
  + `16.4-limitless`
  + `16.6-limitless`
+ `--storage-type`：資料庫叢集必須使用 `aurora-iopt1` 資料庫叢集儲存組態。
+ `--cluster-scalability-type`：指定 Aurora 資料庫叢集的可擴展性模式。設為 `limitless` 時，叢集會以 Aurora PostgreSQL Limitless Database 的形式運作。設為 `standard` (預設值) 時，叢集會使用一般資料庫執行個體建立。
**注意**  
您無法在建立資料庫叢集之後修改此設定。
+ `--master-username`：資料庫叢集主要使用者的名稱。
+ `--master-user-password`：主要使用者密碼。
+ `--enable-performance-insights` 以開啟 Database Insights 的 Performance Insights。
+ `--performance-insights-retention-period`：資料庫叢集資料的保留期間。若要開啟 Database Insights ，保留期必須至少為 465 天。
+ `--monitoring-interval`：為資料庫叢集收集增強型監控指標點之間的間隔 (秒)。此值不能是 `0`。
+ `--monitoring-role-arn`：允許 RDS 將增強型監控指標傳送到 Amazon CloudWatch Logs 之 IAM 角色的 Amazon Resource Name (ARN)。
+ `--enable-cloudwatch-logs-exports`：您必須將 `postgresql` 日誌匯出至 CloudWatch Logs。

下列範例會在建立資料庫叢集時啟用 Database Insights 的進階模式。

針對 Linux、macOS 或 Unix：

```
aws rds create-db-cluster \
--db-cluster-identifier my-limitless-cluster \
--database-insights-mode advanced \
--engine aurora-postgresql \
--engine-version 16.6-limitless \
--storage-type aurora-iopt1 \
--cluster-scalability-type limitless \
--master-username myuser \
--master-user-password mypassword \
--enable-performance-insights \
--performance-insights-retention-period 465 \
--monitoring-interval 5 \
--monitoring-role-arn arn:aws:iam::123456789012:role/EMrole \
--enable-cloudwatch-logs-exports postgresql
```

針對 Windows：

```
aws rds create-db-cluster ^
--db-cluster-identifier my-limitless-cluster ^
--database-insights-mode advanced ^
--engine aurora-postgresql ^
--engine-version 16.6-limitless ^
--storage-type aurora-iopt1 ^
--cluster-scalability-type limitless ^
--master-username myuser ^
--master-user-password mypassword ^
--enable-performance-insights ^
--performance-insights-retention-period 465 ^
--monitoring-interval 5 ^
--monitoring-role-arn arn:aws:iam::123456789012:role/EMrole ^
--enable-cloudwatch-logs-exports postgresql
```

------
#### [ RDS API ]

若要在建立資料庫叢集時開啟 Database Insights 的進階模式，請為 [CreateDBCluster](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBCluster.html) Amazon RDS API 操作指定下列參數。
+ `DatabaseInsightsMode` 至 `advanced`
+ `Engine` 至 `aurora-postgresql`
+ `EngineVersion` 至適用於 Limitless Database 的可用引擎版本
+ `StorageType` 至 `aurora-iopt1`
+ `ClusterScalabilityType` 至 `limitless`
+ `MasterUsername`
+ `MasterUserPassword`
+ `EnablePerformanceInsights` 至 `True`
+ `PerformanceInsightsRetentionPeriod` 到至少 `465` 天
+ `MonitoringInterval` 到非 `0` 的值
+ `MonitoringRoleArn` 到允許 RDS 將增強型監控指標傳送到 Amazon CloudWatch Logs 之 IAM 角色的 Amazon Resource Name (ARN)

------

## 為 Aurora PostgreSQL Limitless Database 修改資料庫叢集時，開啟 Database Insights 的進階模式
<a name="limitless-monitoring.cwdbi.advancedmodify"></a>

為 Aurora PostgreSQL Limitless Database 修改資料庫時，開啟 Database Insights。

**注意**  
若要啟用 Database Insights ，資料庫叢集中每個資料庫執行個體都必須具有相同的 Performance Insights 和增強型監控設定。

------
#### [ Console ]

在主控台中，您可以在修改資料庫叢集時開啟 Database Insights 的進階模式。Database Insights 的設定適用於資料庫叢集中的所有資料庫執行個體。

**使用主控台修改資料庫叢集時，開啟 Database Insights 的進階模式**

1. 登入 AWS 管理主控台，開啟位於 [https://console.aws.amazon.com/rds/](https://console.aws.amazon.com/rds/) 的 Amazon RDS 主控台。

1. 選擇 **Databases** (資料庫)。

1. 選擇資料庫叢集，然後選擇**修改**。

1. 在 **Database Insights** 區段中，選取**進階模式**。然後選擇下列選項：
   + **Retention (保留)** – 保留 Performance Insights 資料的時間。Database Insights 進階模式的保留期間必須為 15-24 個月。
   + **AWS KMS key** – 指定您的 KMS 金鑰。績效詳情使用您的 KMS 金鑰來加密所有可能的敏感資料。將會對傳輸中與靜態資料進行加密。如需更多詳細資訊，請參閱 [加密 Amazon Aurora 資源](Overview.Encryption.md)。

1. 選擇 **Continue** (繼續)。

1. 在 **Scheduling of Modifications (修改排程)** 中，選擇 **Apply immediately (立即套用)**。如果您選擇**在下一個排定的維護時段套用**，則資料庫會忽略此設定，並立即開啟 Database Insights 的進階模式。

1. 選擇**修改叢集**。

------
#### [ AWS CLI ]

若要在修改資料庫叢集時開啟 Database Insights 的進階模式，請呼叫 [modify-db-cluster](https://docs.aws.amazon.com/cli/latest/reference/rds/modify-db-cluster.html) AWS CLI 命令並提供下列值：
+ `--database-insights-mode advanced` 以開啟 Database Insights 的進階模式。
+ `--db-cluster-identifier`：資料庫叢集的識別符。
+ `--enable-performance-insights` 以開啟 Database Insights 的 Performance Insights。
+ `--performance-insights-retention-period`：資料庫叢集的資料保留期間。若要開啟 Database Insights 的進階模式，保留期必須至少為 465 天。

下列範例會在修改資料庫叢集時啟用 Database Insights 的進階模式。

針對 Linux、macOS 或 Unix：

```
aws rds modify-db-cluster \
    --database-insights-mode advanced \
    --db-cluster-identifier sample-db-identifier \
    --enable-performance-insights \
    --performance-insights-retention-period 465
```

針對 Windows：

```
aws rds modify-db-cluster ^
    --database-insights-mode advanced ^
    --db-cluster-identifier sample-db-identifier ^
    --enable-performance-insights ^
    --performance-insights-retention-period 465
```

------
#### [ RDS API ]

若要在修改資料庫叢集時開啟 Database Insights 的進階模式，請為 [ModifyDBCluster](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_ModifyDBCluster.html) Amazon RDS API 操作指定下列參數。
+ `DatabaseInsightsMode` 至 `advanced`
+ `EnablePerformanceInsights` 至 `True`
+ `PerformanceInsightsRetentionPeriod` 到至少 `465` 天

------