

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

# 編輯您帳戶中擴充功能的組態資料
<a name="registry-set-configuration"></a>

本主題提供在特定區域中編輯您帳戶內擴充功能組態資料的指引。擴充功能可以包含套用至指定帳戶和區域擴充功能之所有執行個體的組態屬性。擴充功能作者會在擴充功能的組態定義中定義這些內容。如果擴充功能組態定義中有任何所需屬性，您必須指定這些屬性，才能在帳戶和區域中使用擴充功能。

如需有關開發擴充功能時如何定義組態定義的更多資訊，請參閱下列文件。
+ [勾點組態結構描述語法參考](https://docs.aws.amazon.com/cloudformation-cli/latest/hooks-userguide/hook-configuration-schema.html)
+ [定義擴充功能的帳戶層級組態](https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-model.html#resource-type-howto-configuration)

**Topics**
+ [使用動態參考所需的許可](#registry-set-configuration-considerations)
+ [編輯擴充功能的組態資料 (主控台)](#registry-set-configuration-procedure-console)
+ [編輯擴充功能的組態資料 (AWS CLI)](#registry-set-configuration-procedure-cli)

## 使用動態參考所需的許可
<a name="registry-set-configuration-considerations"></a>

如果您的組態資料包含儲存在 AWS Systems Manager 或 中的值的動態參考 AWS Secrets Manager，則用於佈建 類型的任何角色 （例如，建立或更新堆疊時） 必須具有適當的許可才能擷取該值。具體而言：
+ 如果組態資料包含存儲在 AWS Systems Manager Parameter Store 中的參數，則用於佈建類型的使用者或角色必須具備呼叫 [https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_GetParameter.html](https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_GetParameter.html) 的許可。
+ 如果組態資料包含存放在 中的秘密 AWS Secrets Manager，則用來佈建 類型的使用者或角色必須具有呼叫 的許可[https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_GetSecretValue.html](https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_GetSecretValue.html)。

如需詳細資訊，請參閱[使用動態參考取得存放在其他服務中的值](dynamic-references.md)。

## 編輯擴充功能的組態資料 (主控台)
<a name="registry-set-configuration-procedure-console"></a>

請依照本節中的步驟，使用主控台執行下列操作：
+ 檢視擴充功能的目前組態資料
+ 更新您帳戶的擴充功能組態資料

**檢視擴充功能的目前組態資料**

1. 登入 AWS 管理主控台 並在 https：//[https://console.aws.amazon.com/cloudformation](https://console.aws.amazon.com/cloudformation/) 開啟 CloudFormation 主控台。

1. 在畫面上方的導覽列上，選擇 AWS 區域。

1. 在導覽窗格的**登錄檔**下方，選擇**已啟用的擴充功能**。

1. 找到您要檢視的擴充功能。如需詳細資訊，請參閱[在 CloudFormation 登錄檔中檢視可用的與已啟用擴充功能](registry-view.md)。

1. 選擇擴充功能以檢視擴充功能詳細資訊。

1. 在擴充功能詳細資訊頁面上，選擇 **Configuration** (組態) 索引標籤。

1. 展開 **Configuration schema** (組態結構描述) 索引標籤，以查看為擴充功能定義的組態結構描述。

1. 展開 **Configuration** (組態) 索引標籤，以查看您為此擴充功能設定的目前組態。

**更新擴充功能的組態資料**

1. 在擴充功能詳細資訊頁面上，從**組態**索引標籤中，選擇**編輯組態**。

   或者，從 **Actions** (動作) 中，選擇**編輯**，然後選擇**編輯組態**。

   CloudFormation 會顯示 **Configure extension** (設定擴充功能) 頁面。確保已開啟 **View configuration schema** (檢視組態結構描述) 以查看擴充功能目前的組態定義結構描述。

1. 在 **Configuration JSON** (組態 JSON) 文字方塊中，輸入 JSON 字串，代表您要為此擴充功能設定的組態結構描述。此字串必須根據 **Configuration schema** (組態結構描述) 中定義的結構描述進行驗證。

1. 選擇**設定擴充功能**。

## 編輯擴充功能的組態資料 (AWS CLI)
<a name="registry-set-configuration-procedure-cli"></a>

請依照本節中的步驟使用 AWS CLI 來：
+ 檢視擴充功能的目前組態資料
+ 更新您帳戶的擴充功能組態資料

**檢視擴充功能的目前組態資料**
+ 使用 [https://docs.aws.amazon.com/cli/latest/reference/cloudformation/describe-type.html](https://docs.aws.amazon.com/cli/latest/reference/cloudformation/describe-type.html) 命令傳回有關擴充功能的詳細資訊。該輸出的 `ConfigurationSchema` 元素包含指定區域中擴充功能的目前組態定義。

  或者，使用 [https://docs.aws.amazon.com/cli/latest/reference/cloudformation/batch-describe-type-configurations.html](https://docs.aws.amazon.com/cli/latest/reference/cloudformation/batch-describe-type-configurations.html) 命令傳回有關多個擴充功能的組態資料。

**更新擴充功能的組態資料**
+ 若要指定組態資料，請使用 [https://docs.aws.amazon.com/cli/latest/reference/cloudformation/set-type-configuration.html](https://docs.aws.amazon.com/cli/latest/reference/cloudformation/set-type-configuration.html) 命令。您為 `--configuration` 傳遞的 JSON 必須根據擴充功能的組態結構描述進行驗證。

  在下列範例中，**set-type-configuration** 命令會指定 `--configuration` 選項組態資料 *`"{"CredentialKey": "testUserCredential"}"`*。

  ```
  aws cloudformation set-type-configuration --type RESOURCE \
    --type-name My::Resource::Example \
    --configuration-alias default \
    --configuration "{"CredentialKey": "testUserCredential"}" \
    --region us-west-2
  ```