When you create stacks to manage resources by using Resource Orchestration Service (ROS), you may need to open multiple consoles to query resource parameters. To dynamically configure parameters in the ROS console, in your template you can set AssociationProperty to obtain the resources in the specified region and set AssociationPropertyMetadata to add filter conditions for parameters.

Description

You can specify one of the following types of values for AssociationPropertyMetadata based on your business requirements:

  • Static values. For example, cn-hangzhou in "RegionId": "cn-hangzhou" is a static value.
  • Dynamic values in the ${ParemeterKey} format. For example, ${VpcId} in "VpcId": "${VpcId}" is a dynamic value that ROS can obtain from the template.
    Note To change a dynamic value to a static value, add an exclamation point (!). For example, you can add an exclamation point to ${Literal} to obtain the static value ${!Literal}.

The following table describes the AssociationProperty and AssociationPropertyMetadata parameters that are supported by ROS.

AssociationProperty Description AssociationPropertyMetadata
Password Specifies the password. None
TextArea Specifies the rich text. None
Json Specifies the object. None
CommaDelimitedList Specifies the array. Separate multiple arrays with commas (,). None
Code Specifies the code. None
FileContent Specifies the content that is read from a local file. AcceptFileSuffixes
Cron Specifies the CRON expression. None
ALIYUN::ECS::RegionId Specifies the ID of the region. None
ALIYUN::ECS::ZoneId Specifies the ID of the zone. RegionId
ALIYUN::ECS::Instance::InstanceId Specifies the ID of the Elastic Compute Service (ECS) instance. RegionId
ALIYUN::RDS::Instance::InstanceId Specifies the ID of the ApsaraDB RDS instance.
  • RegionId
  • ZoneId
ALIYUN::ECS::Disk::DataDiskCategory Specifies the category of the data disk.
  • RegionId
  • ZoneId
  • InstanceType
ALIYUN::ECS::Disk::SystemDiskCategory Specifies the category of the system disk.
  • RegionId
  • ZoneId
  • InstanceType
ALIYUN::ECS::Instance::ImageId Specifies the ID of the image. RegionId
ALIYUN::ECS::VPC::VPCId Specifies the ID of the virtual private cloud (VPC). RegionId
ALIYUN::ECS::VSwitch Specifies the vSwitch.
  • RegionId
  • ZoneId
  • VpcId
ALIYUN::ECS::VSwitch::VSwitchId Specifies the ID of the vSwitch.
  • RegionId
  • ZoneId
  • VpcId
ALIYUN::ECS::Instance::InstanceType Specifies the instance type of the ECS instance.
  • RegionId
  • ZoneId
  • InstanceChargeType
  • SpotStrategy
ALIYUN::ECS::SecurityGroup::SecurityGroupId Specifies the ID of the security group.
  • RegionId
  • VpcId
ALIYUN::ECS::KeyPair::KeyPairName Specifies the key pair. RegionId
ALIYUN::ECS::Snapshot::AutoSnapshotPolicyId Specifies the automatic snapshot policy. RegionId
ALIYUN::RDS::Instance::InstanceType Specifies the instance type of the ApsaraDB RDS instance.
  • RegionId
  • ZoneId
  • InstanceChargeType
  • Category
  • Engine
  • EngineVersion
  • DBInstanceClass
  • OrderType
  • DBInstanceStorageType
  • DispenseMode
ALIYUN::SLB::Instance::InstanceType Specifies the instance type of the Server Load Balancer (SLB) instance.
  • RegionId
  • ZoneId
  • InstanceChargeType
  • SpotStrategy
ALIYUN::OOS::Template::TemplateName Specifies the Operation Orchestration Service (OOS) template. RegionId
ALIYUN::OOS::Template::TemplateVersion Specifies the version of the OOS template.
  • RegionId
  • TemplateName
ALIYUN::OOS::Parameter::Value Specifies the regular OOS parameter. RegionId
ALIYUN::OOS::SecretParameter::Value Specifies the encrypted OOS parameter. RegionId
ALIYUN::OOS::Package::PackageName Specifies the OOS software package. RegionId
ALIYUN::OOS::Package::PackageVersion Specifies the version of the OOS software package.
  • RegionId
  • TemplateName
ALIYUN::VPC::VirtualBorderRouter::RouteTableId Specifies the virtual border router (VBR). RegionId
ALIYUN::ESS::ScalingConfiguration::ScalingConfigurationId Specifies the scaling configuration. RegionId
ALIYUN::RAM::User Specifies the RAM user. RegionId
ALIYUN::RAM::Role Specifies the RAM role. RegionId

Example 1: AssociationProperty

In this example, AssociationProperty is set to ALIYUN::ECS::Instance::ImageId. This obtains the IDs of all images in the specified region.

"Parameters": {
  "UserName": {
    "Label": "Username",
    "Description": "Enter the username",
    "Default": "anonymous",
    "Type": "String",
    "MinLength": "6",
    "MaxLength": "12",
    "AllowedValues": [
      "anonymous",
      "user-one",
      "user-two"
    ]
  },
  "PassWord": {
    "Label": "Password",
    "NoEcho": "True",
    "Description": "Enter the password",
    "Type": "String",
    "MinLength": "1",
    "MaxLength": "41",
    "AllowedPattern": "[a-zA-Z0-9]*"
  },
  "ImageId": {
    "Label": "Image",
    "Type": "String",
    "Description": "Select an image",
    "AssociationProperty": "ALIYUN::ECS::Instance::ImageId",
    "Default": "centos_7_7_x64_20G_alibase_2020****.vhd"
  }
}

Parameter description:

  • UserName: the name of the user. The value is of the String type and must be 6 to 12 characters in length. Default value: anonymous. Valid values:
    • anonymous
    • user-one
    • user-two
  • PassWord: the password. The value is of the String type. No default value is provided. The value must be 1 to 41 characters in length and can contain uppercase letters, lowercase letters, and digits.

    If NoEcho is set to true, no parameter value is returned when you query the stack.

  • ImageId: the ID of the image. The value is of the String type.

    If you set AssociationProperty to ALIYUN::ECS::Instance::ImageId, ROS verifies whether the specified image ID that you want to use to create the stack is valid and shows all other image IDs in the specified region in a drop-down list.

Example 2: AssociationPropertyMetadata

In this example, AssociationProperty and AssociationPropertyMetadata are set to query the vSwitch of the specified VPC and zone. AssociationPropertyMetadata includes RegionId, VpcId, and ZoneId. In this example, RegionId is set to cn-hangzhou, VpcId is set to ${VpcId}, and ZoneId is set to ${EcsZone}. ${VpcId} and ${EcsZone} are dynamic values of ALIYUN::ECS::VPC::VPCId and ALIYUN::ECS::Instance::ZoneId. The relationships between the vSwitch, VPC, and zone are established.

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "VpcId": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::VPC::VPCId"
    },
    "EcsZone": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::Instance::ZoneId"
    },
    "VSwitchId": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
      "AssociationPropertyMetadata": {
           "RegionId": "cn-hangzhou",
           "VpcId": "${VpcId}",
       "ZoneId": "${EcsZone}"
      }
    }
  }
}