All Products
Search
Document Center

Resource Orchestration Service:Fn::ListMerge

Last Updated:Jun 04, 2026

Fn::ListMerge concatenates two or more lists into a single list.

Declaration

  • JSON

    {
      "Fn::ListMerge": [
        [
          "list_1_item_1",
          "list_1_item_2",
          ...
        ],
        [
          "list_2_item_1",
          "list_2_item_2",
          ...
        ],
         ...
      ]
    }
  • YAML

    • Syntax for the full function name:

      Fn::ListMerge:
        - - list_1_item_1
          - list_1_item_2
          - ...
        - - list_2_item_1
          - list_2_item_2
          - ...
    • Syntax for the short form:

      !ListMerge [[list_1_item_1, list_1_item_2, ...], [list_2_item_1, list_2_item_2, ...], ...]

Parameters

  • list_1_item_1, list_1_item_2, ...: the first list to merge.

  • list_2_item_1, list_2_item_2, ...: the second list to merge.

Examples

The following example attaches two Elastic Compute Service (ECS) instance groups to a Server Load Balancer (SLB) instance. Fn::ListMerge combines the instance IDs from both groups into a single backend server list.

ROSTemplateFormatVersion: '2015-09-01'
Resources:
  LoadBalancer:
    Type: ALIYUN::SLB::LoadBalancer
    Properties:
      LoadBalancerName: ros
      AddressType: internet
      InternetChargeType: paybybandwidth
  BackendServer1:
    Type: ALIYUN::ECS::InstanceGroup
    Properties:
      ImageId: m-2ze9uqi7wo61hwep****
      InstanceType: ecs.t1.small
      SecurityGroupId: sg-2ze8yxgempcdsq3i****
      MaxAmount: 1
      MinAmount: 1
  BackendServer2:
    Type: ALIYUN::ECS::InstanceGroup
    Properties:
      ImageId: m-2ze9uqi7wo61hwep****
      InstanceType: ecs.t1.small
      SecurityGroupId: sg-2ze8yxgempcdsq3i****
      MaxAmount: 1
      MinAmount: 1
  Attachment:
    Type: ALIYUN::SLB::BackendServerAttachment
    Properties:
      LoadBalancerId: !Ref LoadBalancer
      BackendServerList: !ListMerge [!GetAtt BackendServer1.InstanceIds, !GetAtt BackendServer2.InstanceIds]

!GetAtt BackendServer1.InstanceIds and !GetAtt BackendServer2.InstanceIds each return a list of instance IDs. !ListMerge concatenates them into one list, which is passed to BackendServerList.

Supported functions