Fungsi bawaan Fn::ListMerge menggabungkan beberapa daftar menjadi satu daftar tunggal.
Deklarasi
JSON
{ "Fn::ListMerge": [ [ "list_1_item_1", "list_1_item_2", ... ], [ "list_2_item_1", "list_2_item_2", ... ], ... ] }YAML
Sintaks untuk nama fungsi lengkap:
Fn::ListMerge: - - list_1_item_1 - list_1_item_2 - ... - - list_2_item_1 - list_2_item_2 - ...Sintaks untuk bentuk pendek:
!ListMerge [[list_1_item_1, list_1_item_2, ...], [list_2_item_1, list_2_item_2, ...], ...]
Parameter
list_1_item_1, list_1_imte_2, ...: Daftar pertama yang akan digabungkan.list_2_item_1, list_2_imte_2, ...: Daftar kedua yang akan digabungkan ke dalam daftar pertama.
Contoh
Pada contoh berikut, dua grup instance Elastic Compute Service (ECS) dihubungkan ke instance Server Load Balancer (SLB):
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]