All Products
Search
Document Center

Resource Orchestration Service:Metadata

Last Updated:Jun 13, 2024

You can use Metadata to group parameters defined in the Parameters section of a template and hide specific parameters. To view the display effect of the parameters, you can go to the Configure Parameters step in the Resource Orchestration Service (ROS) console.

Metadata syntax

Metadata:
  ALIYUN::ROS::Interface:
    # ParameterGroups is required.
    ParameterGroups:
      - <ParameterGroup1>
      - <ParameterGroup2>
      - ...

ParameterGroup syntax

# Parameters is required.
Parameters: 
    - <Parameter1>
    - <Parameter2>
    - ...
# Label is required.
Label: 
    default: <Custom String>

Example: Group parameters

You can group parameters that are defined in the Parameters section of a template and specify a label for each group.

ROSTemplateFormatVersion: '2015-09-01'
Description: Metadata example.
Metadata:
  ALIYUN::ROS::Interface:
    ParameterGroups:
      - Parameters:
          - VpcName
          - VpcCidrBlock
        Label:
          default: VPC
      - Parameters:
          - VswName
          - VswCidrBlock
        Label:
          default: VSwitch
Parameters:
  VpcName:
    Type: String
    Label: Name
    Description: The name must be 2 to 128 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). It must start with a letter. 
    Default: MyVPC
  VswName:
    Type: String
    Label: Name
    Description: The name must be 2 to 128 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). It must start with a letter. 
    Default: MyVSwitch
  VpcCidrBlock:
    Type: String
    AllowedValues:
      - 10.0.0.0/8
      - 172.16.0.0/12
      - 192.168.0.0/16
    Description: The CIDR block of the VPC. To specify a custom CIDR block, you must change the valid CIDR blocks that are specified by AllowedValues in the template. The custom CIDR block must be a subnet of the valid CIDR blocks. 
    Label: IPv4 CIDR Block
    Default: 192.168.0.0/16
  VswCidrBlock:
    Type: String
    Description: The CIDR block of the vSwitch must be a subnet of the VPC CIDR block and must not be used by other vSwitches. 
    Label: IPv4 CIDR Block
    Default: 192.168.1.0/24
Resources:
  VSwitch:
    Type: ALIYUN::ECS::VSwitch
    Properties:
      VpcId:
        Ref: VPC
      ZoneId:
        Fn::Select:
          - '1'
          - Fn::GetAZs:
              Ref: ALIYUN::Region
      CidrBlock:
        Ref: VswCidrBlock
      VSwitchName:
        Ref: VswName
  VPC:
    Type: ALIYUN::ECS::VPC
    Properties:
      CidrBlock:
        Ref: VpcCidrBlock
      VpcName:
        Ref: VpcName

Example: Hide parameters

You can specify desired parameters in Hidden in a template to prevent the parameter information from being displayed in the ROS console.

ROSTemplateFormatVersion: '2015-09-01'
Description: Metadata example.
Metadata:
  ALIYUN::ROS::Interface:
    ParameterGroups:
      - Parameters:
          - VpcName
        Label:
          default: VPC
      - Parameters:
          - VswName
        Label:
          default: VSwitch
    # The parameters that you specify in Hidden are not displayed in the ROS console.
    Hidden:
      - VpcCidrBlock
      - VswCidrBlock
Parameters:
  VpcName:
    Type: String
    Label: Name
    Description: The name must be 2 to 128 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). It must start with a letter. 
    Default: MyVPC
  VswName:
    Type: String
    Label: Name
    Description: The name must be 2 to 128 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). It must start with a letter. 
    Default: MyVSwitch
  VpcCidrBlock:
    Type: String
    AllowedValues:
      - 10.0.0.0/8
      - 172.16.0.0/12
      - 192.168.0.0/16
    Description: The CIDR block of the VPC. To specify a custom CIDR block, you must change the valid CIDR blocks that are specified by AllowedValues in the template. The custom CIDR block must be a subnet of the valid CIDR blocks. 
    Label: IPv4 CIDR Block
    Default: 192.168.0.0/16
  VswCidrBlock:
    Type: String
    Description: The CIDR block of the vSwitch must be a subnet of the VPC CIDR block and must not be used by other vSwitches. 
    Label: IPv4 CIDR Block
    Default: 192.168.1.0/24
Resources:
  VSwitch:
    Type: ALIYUN::ECS::VSwitch
    Properties:
      VpcId:
        Ref: VPC
      ZoneId:
        Fn::Select:
          - '1'
          - Fn::GetAZs:
              Ref: ALIYUN::Region
      CidrBlock:
        Ref: VswCidrBlock
      VSwitchName:
        Ref: VswName
  VPC:
    Type: ALIYUN::ECS::VPC
    Properties:
      CidrBlock:
        Ref: VpcCidrBlock
      VpcName:
        Ref: VpcName