

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

# 將資料庫叢集參數群組與 Amazon Aurora 中的資料庫叢集建立關聯
<a name="USER_WorkingWithParamGroups.AssociatingCluster"></a>

您可以使用自訂設定，建立自己的資料庫叢集參數群組。您可以使用 AWS 管理主控台、AWS CLI 或 RDS API，將資料庫叢集參數群組與資料庫叢集建立關聯。您可以在建立或修改資料庫叢集時執行此動作。

如需建立資料庫叢集參數群組的詳細資訊，請參閱[在 Amazon Aurora 中建立資料庫叢集參數群組](USER_WorkingWithParamGroups.CreatingCluster.md)。如需建立資料庫叢集的詳細資訊，請參閱[建立 Amazon Aurora 資料庫叢集](Aurora.CreateInstance.md)。如需修改資料庫叢集的詳細資訊，請參閱[修改 Amazon Aurora 資料庫叢集](Aurora.Modifying.md)。

**注意**  
對於 Aurora PostgreSQL 15.2、14.7、13.10、12.14 和所有的第 11 版，當您變更與資料庫叢集相關聯的資料庫叢集參數群組後，請將每個複本執行個體重新開機，以套用變更。  
若要判斷資料庫叢集的主要資料庫執行個體是否必須重新啟動才能套用變更，請執行下列 AWS CLI 命令：  
`aws rds describe-db-clusters --db-cluster-identifier db_cluster_identifier`  
檢查輸出中主要資料庫執行個體的 `DBClusterParameterGroupStatus` 值。如果值為 `pending-reboot`，則重新啟動資料庫叢集的主要資料庫執行個體。

## 主控台
<a name="USER_WorkingWithParamGroups.AssociatingCluster.CON"></a>

**將資料庫叢集參數群組與資料庫叢集建立關聯**

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

1. 在導覽窗格中選擇 **Databases (資料庫)**，然後選取您要修改的資料庫叢集。

1. 選擇 **Modify (修改)**。**Modify DB cluster (修改資料庫叢集)** 頁面隨即出現。

1. 變更 **DB cluster parameter group** (資料庫叢集參數群組) 設定。

1. 選擇 **Continue (繼續)**，並檢查修改的摘要。

   無論 **Scheduling of modifications** (修改排程) 設定為何，都會立即套用變更。

1. 在確認頁面上，檢閱您的變更。如果都正確，請選擇 **Modify cluster (修改叢集)** 以儲存您的變更。

   或者，選擇 **Back (上一步)** 以編輯變更，或是選擇 **Cancel (取消)** 以取消變更。

## AWS CLI
<a name="USER_WorkingWithParamGroups.AssociatingCluster.CLI"></a>

若要將資料庫叢集參數群組與資料庫叢集建立關聯，請使用 AWS CLI [https://docs.aws.amazon.com/cli/latest/reference/rds/modify-db-cluster.html](https://docs.aws.amazon.com/cli/latest/reference/rds/modify-db-cluster.html) 命令搭配下列選項：
+ `--db-cluster-name`
+ `--db-cluster-parameter-group-name`

下面的範例將 `mydbclpg` 資料庫參數群組與 `mydbcluster` 資料庫叢集建立關聯。

**Example**  
對於 Linux、macOS 或 Unix：  

```
aws rds modify-db-cluster \
    --db-cluster-identifier mydbcluster \
    --db-cluster-parameter-group-name mydbclpg
```
在 Windows 中：  

```
aws rds modify-db-cluster ^
    --db-cluster-identifier mydbcluster ^
    --db-cluster-parameter-group-name mydbclpg
```

## RDS API
<a name="USER_WorkingWithParamGroups.AssociatingCluster.API"></a>

若要將資料庫叢集參數群組與資料庫叢集建立關聯，請使用 RDS API [https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_ModifyDBCluster.html](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_ModifyDBCluster.html) 操作搭配下列參數：
+ `DBClusterIdentifier`
+ `DBClusterParameterGroupName`