When you create a stack to manage resources in the Resource Orchestration Service (ROS) console, you may need to open multiple consoles to query resource parameters. In the Parameters section of a template, you can specify AssociationProperty to obtain the resources in the specified region and specify AssociationPropertyMetadata to add filter conditions for the resource parameters. This simplifies the operations that you perform to configure parameter settings in the console.

Parameters

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

  • A literal value. For example, if you set AssociationPropertyMetadata to "RegionId": "cn-hangzhou", ROS resolves this value as the literal value cn-hangzhou.
  • A variable. Specify a variable in the ${ParemeterKey} format. For example, if you set AssociationPropertyMetadata to "VpcId": "${VpcId}", ROS resolves this value as a variable that varies based on the value of the VpcId parameter in the template.
    Note
    • If you need to specify a variable in the ${ParemeterKey} format as a literal value, you can add an exclamation point (!) to ${ParemeterKey} to use the ${!ParemeterKey} format. For example, if you set a value to ${!Literal}, ROS resolves this value as ${Literal}.
    • If you need to specify a variable for a parameter in a Terraform template, add $ to ${ParemeterKey} to use the $${ParemeterKey} format. For example, if you set AssociationPropertyMetadata to "VpcId": "$${VpcId}", ROS resolves this value as a variable that varies based on the value of the VpcId parameter in the Terraform template.

The following table describes the relationship between the values of AssociationProperty and AssociationPropertyMetadata.

AssociationProperty value Description AssociationPropertyMetadata value
Password The password. None.
TextArea The rich text. None.
Json The object. None.
CommaDelimitedList The array. Separate elements in the array with commas (,). None.
Code The code. None.
FileContent Specifies the content that is read from a local file. AcceptFileSuffixes: the format of the file that you can upload in ROS.
Cron The cron expression. None.
ChargeType The billing method. None.
ALIYUN::ECS::RegionId The ID of the region. None.
ALIYUN::ECS::ZoneId The ID of the zone.
  • RegionId: the ID of the region.
  • ShowRandom: the option that is randomly assigned by the system.
ALIYUN::ECS::Instance::InstanceId The ID of the Elastic Compute Service (ECS) instance. RegionId: the ID of the region.
ALIYUN::RDS::Instance::InstanceId The ID of the ApsaraDB RDS instance.
  • RegionId: the ID of the region.
  • ZoneId: the ID of the zone.
ALIYUN::ECS::Disk::DataDiskCategory The category of the data disk.
  • RegionId: the ID of the region.
  • ZoneId: the ID of the zone.
  • InstanceType: the instance type.
ALIYUN::ECS::Disk::SystemDiskCategory The category of the system disk.
  • RegionId: the ID of the region.
  • ZoneId: the ID of the zone.
  • InstanceType: the instance type.
ALIYUN::ECS::Instance::ImageId The ID of the image. RegionId: the ID of the region.
ALIYUN::ECS::VPC::VPCId The ID of the virtual private cloud (VPC). RegionId: the ID of the region.
ALIYUN::ECS::VSwitch The information about the vSwitch.
  • RegionId: the ID of the region.
  • ZoneId: the ID of the zone.
  • VpcId: the ID of the VPC.
ALIYUN::ECS::VSwitch::VSwitchId The ID of the vSwitch.
  • RegionId: the ID of the region.
  • ZoneId: the ID of the zone.
  • VpcId: the ID of the VPC.
ALIYUN::ECS::Instance::InstanceType The type of the ECS instance.
  • RegionId: the ID of the region.
  • ZoneId: the ID of the zone.
  • InstanceChargeType: the billing method of the instance.
  • SpotStrategy: the bidding policy for the pay-as-you-go instance.
ALIYUN::ECS::SecurityGroup::SecurityGroupId The ID of the security group.
  • RegionId: the ID of the region.
  • VpcId: the ID of the VPC.
ALIYUN::ECS::KeyPair::KeyPairName The key pair. RegionId: the ID of the region.
ALIYUN::ECS::Snapshot::AutoSnapshotPolicyId The automatic snapshot policy. RegionId: the ID of the region.
ALIYUN::RDS::Instance::InstanceType The type of the ApsaraDB RDS instance.
  • RegionId: the ID of the region.
  • ZoneId: the ID of the zone.
  • InstanceChargeType: the billing method of the instance.
  • Category: the edition of the instance.
  • Engine: the type of the database engine.
  • EngineVersion: the version of the database engine.
  • DBInstanceClass: the instance type.
  • OrderType: the order type.
  • DBInstanceStorageType: the storage type of the instance.
  • DispenseMode: the allocation mode.
ALIYUN::SLB::Instance::InstanceType The specification of the Server Load Balancer (SLB) instance.
  • RegionId: the ID of the region.
  • ZoneId: the ID of the zone.
  • InstanceChargeType: the billing method of the instance.
  • SpotStrategy: the bidding policy for the pay-as-you-go instance.
ALIYUN::OOS::Template::TemplateName The name of the Operation Orchestration Service (OOS) template. RegionId: the ID of the region.
ALIYUN::OOS::Template::TemplateVersion The version of the OOS template.
  • RegionId: the ID of the region.
  • TemplateName: the name of the template.
ALIYUN::OOS::Parameter::Value The common parameter of OOS. RegionId: the ID of the region.
ALIYUN::OOS::SecretParameter::Value The encryption parameter of OOS. RegionId: the ID of the region.
ALIYUN::OOS::Package::PackageName The name of the OOS software package. RegionId: the ID of the region.
ALIYUN::OOS::Package::PackageVersion The version of the OOS software package.
  • RegionId: the ID of the region.
  • TemplateName: the name of the template.
ALIYUN::VPC::VirtualBorderRouter::RouteTableId The Virtual Border Router (VBR). RegionId: the ID of the region.
ALIYUN::ESS::ScalingConfiguration::ScalingConfigurationId The ID of the scaling configuration. RegionId: the ID of the region.
ALIYUN::RAM::User The RAM user. RegionId: the ID of the region.
ALIYUN::RAM::Role The RAM role. RegionId: the ID of the region.

Example 1: AssociationProperty

In this example, AssociationProperty is set to ALIYUN::ECS::Instance::ImageId to query the IDs of all images in the selected 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"
  }
}

Fields in the Parameters section:

  • UserName: the username. 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 letters and digits.

    NoEcho is set to true, which specifies that ROS returns a password that is set to ciphertext after you query the stack.

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

    AssociationProperty is set to ALIYUN::ECS::Instance::ImageId. This way, the ROS console verifies whether the ID of the specified image that you use to create the stack is valid. The ROS console also displays IDs of other images that are available in the same region as the specified image in a drop-down list.

Example 2: AssociationPropertyMetadata

In this example, AssociationProperty and AssociationPropertyMetadata are specified to query the vSwitch of the specified VPC and zone. For AssociationPropertyMetadata, RegionId is set to the literal value cn-hangzhou, VpcId is set to the variable ${VpcId}, and ZoneId is set to the variable ${EcsZone}. ${VpcId} varies based on the value of ALIYUN::ECS::VPC::VPCId, and ${EcsZone} varies based on the value of ALIYUN::ECS::Instance::ZoneId. This way, the vSwitch is associated with the specified VPC and zone.

{
  "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}"
      }
    }
  }
}

More examples

You can specify AssociationProperty and AssociationPropertyMetadata to perform the following operations: