ALIYUN::SLB::LoadBalancerClone类型用于克隆负载均衡实例。

语法

{
  "Type": "ALIYUN::SLB::LoadBalancerClone",
  "Properties": {
    "Tags": List,
    "ResourceGroupId": String,
    "VSwitchId": String,
    "LoadBalancerName": String,
    "SourceLoadBalancerId": String,
    "TagsPolicy": String,
    "BackendServersPolicy": String,
    "BackendServers": List
  }
}

属性

属性名称 类型 必须 允许更新 描述 约束
ResourceGroupId String 资源组ID。
VSwitchId String 交换机ID。 必须为源负载均衡实例所属专有网络下的交换机。不指定该参数时,将使用源负载均衡实例的交换机。
SourceLoadBalancerId String 将要克隆的负载均衡实例ID。
BackendServersPolicy String 克隆策略,指定配置新负载均衡实例需要监听的ECS实例以及各ECS实例的权重。 取值:
  • clone(默认值):把源负载均衡实例中监听的ECS实例和权重配置全部克隆到新的负载均衡实例中。
  • empty:不给新的负载均衡实例添加任何ECS实例。
  • append:既克隆源负载均衡实例中监听的ECS实例和权重配置,也添加新的ECS实例和权重配置到新的负载均衡实例。
  • replace:只添加新的ECS实例列表和权重配置而不克隆源负载均衡实例所监听的ECS实例列表和权重配置。
BackendServers List 指定新添加的需要监听的ECS实例列表。 详情请参见BackendServers属性
LoadBalancerName String 负载均衡实例名称。 用户自定义字符串。长度为1~80个字符,可包含英文字母、数字、短划线(-)、正斜线(/)、英文句点(.)和下划线(_)。
Tags List SLB实例标签。 标签以键值对方式传入,最多可以设置5组标签。

详情请参见Tags属性

TagsPolicy String 标签策略。 取值:
  • clone:使用源负载均衡实例的标签。
  • empty(默认值):不设置标签。
  • append:保留源实例标签并添加新标签。
  • replace:添加新标签,不保留源实例标签 。

BackendServers语法

"BackendServers": [
  {
    "Type": String,
    "ServerId": String,
    "Description": String,
    "ServerIp": String,
    "Weight": Integer
  }
] 

BackendServers属性

属性名称 类型 必须 允许更新 描述 约束
ServerId String 后端服务器ID。 后端服务器(ECS实例)必须在运行中才可以加入负载均衡实例,每次调用最多可添加20个后端服务器。

只有性能保障型实例支持添加eni类型的后端服务器。

Weight Integer ECS实例在负载均衡实例中的权重。 取值范围:0~100。

默认值:100。

ServerIp String 后端服务器IP地址。
Type String 后端服务器类型。 取值:
  • ecs:ECS实例(默认值)。
  • eni:弹性网卡实例。
  • eci:弹性容器实例。
Description String 后端服务器描述。 长度为1~80个字符,可包含英文字母、汉字、数字、短划线(-)、正斜线(/)、英文句点(.)和下划线(_)。

Tags语法

"Tags": [
  {
    "Value": String,
    "Key": String
  }
]  

Tags属性

属性名称 类型 必须 允许更新 描述 约束
Key String 标签键 长度为1~128个字符,不能以aliyunacs:开头,不能包含http://或者https://
Value String 标签值 长度为0~128个字符,不能以aliyunacs:开头,不能包含http://或者https://

返回值

Fn::GetAtt

LoadBalancerId:新负载均衡实例的ID。

示例

JSON格式

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "LoadBalancerName": {
      "Type": "String",
      "Description": "Name of created load balancer. Length is limited to 1-80 characters, allowed to contain letters, numbers, '-, /, _,.' When not specified, a default name will be assigned."
    },
    "SourceLoadBalancerId": {
      "Type": "String",
      "Description": "Source load balancer id to clone"
    },
    "ResourceGroupId": {
      "Type": "String",
      "Description": "Resource group id."
    },
    "TagsPolicy": {
      "Type": "String",
      "Description": "Solution for handle the tags. If select 'clone', it will clone from source load balancer. If select 'empty' it will not coppy tags. If select 'append' it will append the new tags. If select 'replace' it will add new tags.\nDefault is 'empty'. ",
      "AllowedValues": [
        "clone",
        "empty",
        "append",
        "replace"
      ],
      "Default": "empty"
    },
    "VSwitchId": {
      "Type": "String",
      "Description": "The new VSwitch ID to create load balancer instance. For VPC network only and the VSwitch should belong to the VPC which source load balancer is located.When not specified, source load balancer VSwitch ID will be used."
    },
    "BackendServers": {
      "Type": "Json",
      "Description": "The list of ECS instance, which will attached to load balancer."
    },
    "Tags": {
      "Type": "Json",
      "Description": "Tags to attach to slb. Max support 5 tags to add during create slb. Each tag with two properties Key and Value, and Key is required.",
      "MaxLength": 5
    },
    "BackendServersPolicy": {
      "Type": "String",
      "Description": "Solution for handle the backend server and weights. If select 'clone', it will clone from source load balancer. If select 'empty' it will not attach any backend servers. If select 'append' it will append the new backend server list to source backed servers. If select 'replace' it will only attach new backend server list. Default is 'clone'. ",
      "AllowedValues": [
        "clone",
        "empty",
        "append",
        "replace"
      ],
      "Default": "clone"
    }
  },
  "Resources": {
    "LoadBalancerClone": {
      "Type": "ALIYUN::SLB::LoadBalancerClone",
      "Properties": {
        "LoadBalancerName": {
          "Ref": "LoadBalancerName"
        },
        "SourceLoadBalancerId": {
          "Ref": "SourceLoadBalancerId"
        },
        "ResourceGroupId": {
          "Ref": "ResourceGroupId"
        },
        "TagsPolicy": {
          "Ref": "TagsPolicy"
        },
        "VSwitchId": {
          "Ref": "VSwitchId"
        },
        "BackendServers": {
          "Ref": "BackendServers"
        },
        "Tags": {
          "Ref": "Tags"
        },
        "BackendServersPolicy": {
          "Ref": "BackendServersPolicy"
        }
      }
    }
  },
  "Outputs": {
    "LoadBalancerId": {
      "Description": "The id of load balance generated",
      "Value": {
        "Fn::GetAtt": [
          "LoadBalancerClone",
          "LoadBalancerId"
        ]
      }
    }
  }
}

YAML格式

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  LoadBalancerName:
    Type: String
    Description: >-
      Name of created load balancer. Length is limited to 1-80 characters,
      allowed to contain letters, numbers, '-, /, _,.' When not specified, a
      default name will be assigned.
  SourceLoadBalancerId:
    Type: String
    Description: Source load balancer id to clone
  ResourceGroupId:
    Type: String
    Description: Resource group id.
  TagsPolicy:
    Type: String
    Description: >-
      Solution for handle the tags. If select 'clone', it will clone from source
      load balancer. If select 'empty' it will not coppy tags. If select
      'append' it will append the new tags. If select 'replace' it will add new
      tags.

      Default is 'empty'.
    AllowedValues:
      - clone
      - empty
      - append
      - replace
    Default: empty
  VSwitchId:
    Type: String
    Description: >-
      The new VSwitch ID to create load balancer instance. For VPC network only
      and the VSwitch should belong to the VPC which source load balancer is
      located.When not specified, source load balancer VSwitch ID will be used.
  BackendServers:
    Type: Json
    Description: 'The list of ECS instance, which will attached to load balancer.'
  Tags:
    Type: Json
    Description: >-
      Tags to attach to slb. Max support 5 tags to add during create slb. Each
      tag with two properties Key and Value, and Key is required.
    MaxLength: 5
  BackendServersPolicy:
    Type: String
    Description: >-
      Solution for handle the backend server and weights. If select 'clone', it
      will clone from source load balancer. If select 'empty' it will not attach
      any backend servers. If select 'append' it will append the new backend
      server list to source backed servers. If select 'replace' it will only
      attach new backend server list. Default is 'clone'.
    AllowedValues:
      - clone
      - empty
      - append
      - replace
    Default: clone
Resources:
  LoadBalancerClone:
    Type: 'ALIYUN::SLB::LoadBalancerClone'
    Properties:
      LoadBalancerName:
        Ref: LoadBalancerName
      SourceLoadBalancerId:
        Ref: SourceLoadBalancerId
      ResourceGroupId:
        Ref: ResourceGroupId
      TagsPolicy:
        Ref: TagsPolicy
      VSwitchId:
        Ref: VSwitchId
      BackendServers:
        Ref: BackendServers
      Tags:
        Ref: Tags
      BackendServersPolicy:
        Ref: BackendServersPolicy
Outputs:
  LoadBalancerId:
    Description: The id of load balance generated
    Value:
      'Fn::GetAtt':
        - LoadBalancerClone
        - LoadBalancerId