AWS::CloudFormation::Interface - AWS CloudFormation

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

AWS::CloudFormation::Interface

AWS::CloudFormation::Interface是定義參數在 AWS CloudFormation 主控台中分組和排序方式的中繼資料索引鍵。當您在主控台中建立或更新堆疊時,主控台會依據輸入參數的邏輯 ID 字母順序來列出參數。使用此金鑰時,您可以定義自己的參數分組和排序,以讓使用者有效地指定參數值。例如,您可以將所有 EC2 相關參數分組為一個群組,而將所有 VPC 相關參數分組為另一個群組。

除了分組和排序參數,您還可以定義參數的標籤。標籤是要在主控台中顯示的易讀名稱或描述,而非參數的邏輯 ID。標籤有助使用者了解可為每個參數指定的值。例如,您可以為 KeyPair 參數設定 Select an EC2 key pair 標籤。

注意

只有主 CloudFormation 控台使用中AWS::CloudFormation::Interface繼資料金鑰。 AWS CLI 和 API 調用不使用此密鑰。

語法

若要在 CloudFormation 範本中宣告此實體,請使用下列語法:

JSON

"Metadata" : { "AWS::CloudFormation::Interface" : { "ParameterGroups" : [ ParameterGroup, ... ], "ParameterLabels" : ParameterLabel } }

YAML

Metadata: AWS::CloudFormation::Interface: ParameterGroups: - ParameterGroup ParameterLabels: ParameterLabel

屬性

ParameterGroups

參數群組類型清單;您可以在其中指定群組名稱、每個群組中的參數,以及參數的顯示順序。

必要:否

Type (類型)AWS::CloudFormation::Interface ParameterGroup

更新要求不中斷

ParameterLabels

建立或更新堆疊時, CloudFormation 主控台會顯示參數及其易記名稱的對應。

必要:否

Type (類型)AWS::CloudFormation::Interface ParameterLabel

更新要求不中斷

範例

下列範例定義兩個參數群組:Network ConfigurationAmazon EC2 ConfigurationNetwork Configuration 群組包含 VPCIDSubnetIdSecurityGroupID 參數,這些參數是在範本的 Parameters 區段中定義 (未顯示)。在主控台中,這些參數的顯示順序是由參數的列出順序來定義,從 VPCID 參數開始。本範例會以類似方式來分組和排序 Amazon EC2 Configuration 參數。

本範例也會定義 VPCID 參數的標籤。主控台會顯示 Which VPC should this be deployed to? (此項目應該部署至哪個 VPC?) 而非參數的邏輯 ID (VPCID)。

JSON

"Metadata" : { "AWS::CloudFormation::Interface" : { "ParameterGroups" : [ { "Label" : { "default" : "Network Configuration" }, "Parameters" : [ "VPCID", "SubnetId", "SecurityGroupID" ] }, { "Label" : { "default":"Amazon EC2 Configuration" }, "Parameters" : [ "InstanceType", "KeyName" ] } ], "ParameterLabels" : { "VPCID" : { "default" : "Which VPC should this be deployed to?" } } } }

YAML

Metadata: AWS::CloudFormation::Interface: ParameterGroups: - Label: default: "Network Configuration" Parameters: - VPCID - SubnetId - SecurityGroupID - Label: default: "Amazon EC2 Configuration" Parameters: - InstanceType - KeyName ParameterLabels: VPCID: default: "Which VPC should this be deployed to?"

主控台中的參數群組

下圖會使用此範例的中繼資料金鑰來說明建立或更新堆疊時,主控台會如何顯示參數群組:主控台中的參數群組

主控台,其中顯示此範例的參數群組。