

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

# CloudFormation 範本 Metadata 語法
<a name="metadata-section-structure"></a>

`Metadata` 會使用 JSON 或 YAML 物件儲存額外資訊。您可在範本中使用的範本層級中繼資料類型包括：

自訂中繼資料  
儲存使用者定義的索引鍵/值對。例如，您可提供不影響資源建立，但能說明基礎設施、團隊或部署詳情的額外資訊。

`AWS::CloudFormation::Interface`  
定義輸入參數在 CloudFormation 主控台中顯示的群組和排序。根據預設，CloudFormation 主控台會依據參數的邏輯 ID 字母順序來排序參數。

`AWS::CloudFormation::Designer`  
CloudFormation 設計工具 (Designer) 已於 2025 年 2 月 5 日結束生命週期。



**重要**  
在更新堆疊期間，您無法自行更新 `Metadata` 區段。只有在包含可新增、修改或刪除資源的變更時，才能予以更新。  
CloudFormation 不會轉換、修改或標記您在 `Metadata` 區段中包含的任何資訊。因此，我們強烈建議您不要使用此區段來儲存機密資訊，例如密碼或秘密。

## 語法
<a name="metadata-section-structure-syntax"></a>

若要在您的 CloudFormation 範本中宣告自訂中繼資料，請使用下列語法：

### JSON
<a name="metadata-section-structure-syntax.json"></a>

```
"Metadata" : {
  "Instances" : {"Description" : "Information about the instances"},
  "Databases" : {"Description" : "Information about the databases"}
}
```

### YAML
<a name="metadata-section-structure-syntax.yaml"></a>

```
Metadata:
  Instances:
    Description: "Information about the instances"
  Databases: 
    Description: "Information about the databases"
```

如需 `AWS::CloudFormation::Interface` 的語法，請參閱 [使用 `AWS::CloudFormation::Interface` 中繼資料組織 CloudFormation 參數](aws-cloudformation-interface.md)。