ALIYUN::GA::EndpointGroup

更新时间:
复制 MD 格式

The ALIYUN::GA::EndpointGroup resource creates an endpoint group.

Syntax

{
  "Type": "ALIYUN::GA::EndpointGroup",
  "Properties": {
    "HealthCheckIntervalSeconds": Integer,
    "EndpointGroupRegion": String,
    "TrafficPercentage": Integer,
    "Description": String,
    "HealthCheckPath": String,
    "HealthCheckProtocol": String,
    "ThresholdCount": Integer,
    "HealthCheckPort": Integer,
    "AcceleratorId": String,
    "EndpointConfigurations": List,
    "Name": String,
    "ListenerId": String,
    "HealthCheckEnabled": Boolean,
    "EndpointGroupType": String,
    "HealthCheckHost": String,
    "PortOverrides": List,
    "EndpointIpVersion": String,
    "Tags": List,
    "EndpointProtocolVersion": String,
    "EndpointRequestProtocol": String
  }
}

Properties

Property Type Required Editable Description Constraints
AcceleratorId String Yes No The ID of the Global Accelerator instance. None
EndpointConfigurations List Yes Yes The endpoints. A maximum of four endpoints can be specified.

For more information, see EndpointConfigurations properties.

EndpointGroupRegion String Yes No The region where the endpoint group is deployed. None
ListenerId String Yes No The ID of the listener. None
Description String No Yes The description of the endpoint group. None
EndpointGroupType String No No The type of the endpoint group. Valid values:
  • default (default): a default endpoint group.
  • virtual: a virtual endpoint group.
Note Only listeners that use HTTP or HTTPS support virtual endpoint groups.
EndpointIpVersion String No Yes The backend IP address protocol. Valid values:
  • IPv4 (default): GA uses only IPv4 addresses to communicate with the endpoint service.
  • IPv6: GA uses only IPv6 addresses to communicate with the endpoint service.
  • ProtocolAffinity: GA communicates with the endpoint service using the same IP protocol as the client request.
EndpointProtocolVersion String No Yes The protocol version of the backend service. Valid values:
  • HTTP1.1 (default): HTTP 1.1.
  • HTTP2: HTTP/2.

This parameter is available only when EndpointRequestProtocol (the backend service protocol) is set to HTTPS.

EndpointRequestProtocol String No Yes The protocol of the backend service. Valid values:
  • HTTP (default)
  • HTTPS
Note
  • This parameter is available only when you create an endpoint group for a listener that uses HTTP or HTTPS.
  • For an HTTP listener, the backend service protocol must be HTTP.
HealthCheckEnabled Boolean No Yes Specifies whether to enable the health check feature. Valid values:
  • true (default): Enables the health check feature.
  • false: Disables the health check feature.
HealthCheckHost String No Yes The domain name for the health check. None
HealthCheckIntervalSeconds Integer No Yes The interval between health checks. Unit: seconds.
HealthCheckPath String No Yes The path for the health check. None
HealthCheckPort Integer No Yes The port used for the health check. None
HealthCheckProtocol String No Yes The protocol for the health check. Valid values:
  • tcp: TCP.
  • http: HTTP.
  • https: HTTPS.
Name String No Yes The name of the endpoint group. None
PortOverrides List No Yes The port mappings. For more information, see PortOverrides properties.
Tags List No No The tags of the endpoint group. For more information, see Tags properties.
ThresholdCount Integer No Yes The number of consecutive failed health checks that must occur before an endpoint is considered unhealthy. None
TrafficPercentage Integer No Yes The weight of the endpoint group when the listener is associated with multiple endpoint groups. None

EndpointConfigurations syntax

"EndpointConfigurations": [
  {
    "Type": String,
    "Endpoint": String,
    "Weight": Integer,
    "EnableClientIPPreservation": Boolean,
    "EnableProxyProtocol": Boolean,
    "VpcId": String,
    "VSwitchIds": List,
    "SubAddress": String
  }
]

EndpointConfigurations properties

Property Type Required Editable Description Constraints
Endpoint String Yes Yes The IP address or domain name of the endpoint. None
Type String Yes Yes The type of the endpoint. Valid values:
  • Domain: a custom domain name.
  • Ip: a custom IP address.
Weight Integer Yes Yes The weight of the endpoint. None
EnableClientIPPreservation Boolean No Yes Specifies whether to preserve client source IP addresses. Valid values:
  • true: Preserves client source IP addresses.
  • false (default): Does not preserve client source IP addresses.
EnableProxyProtocol Boolean No Yes Specifies whether the TCP Option Address (TOA) module retrieves the IP address of the client that accesses the endpoint. None
SubAddress String No Yes The private IP address of the elastic network interface (ENI). This parameter is optional when the endpoint type is ENI. If not specified, the primary private IP address of the ENI is used.
VpcId String No Yes The VPC ID. None
VSwitchIds List No Yes The list of vSwitch IDs under the VPC. You can specify a maximum of 2 vSwitch IDs.

PortOverrides syntax

"PortOverrides": [
  {
    "ListenerPort": Integer,
    "EndpointPort": Integer
  }
]

PortOverrides properties

Property Type Required Editable Description Constraints
EndpointPort Integer Yes Yes The endpoint port for port mapping. None
ListenerPort Integer Yes Yes The listener port for port mapping. For TCP listeners:
  • Virtual endpoint groups do not support port mapping.
  • If a virtual endpoint group already exists under the listener, the default endpoint group cannot be configured with port mapping.
  • If the default endpoint group is already configured with port mapping, you cannot add a virtual endpoint group.
  • After port mapping is configured, the following restrictions apply when modifying the listener:
    • Protocol changes are not supported except between HTTP and HTTPS.
    • Listener port: The listener port range you modify must include all listener ports currently configured in the port mapping. For example, if the listener port range is 80-82 and port mapping is configured to endpoint ports 100-102, the listener port range cannot be changed to 80-81.

Tags syntax

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

Tags properties

Property Type Required Editable Description Constraints
Key String Yes No The tag key of the endpoint group. Once specified, the value cannot be an empty string. The key can be up to 64 characters in length, cannot start with aliyun or acs:, and cannot contain http:// or https://. You can specify a maximum of 20 tag keys.
Value String No No The tag value of the endpoint group. Once specified, the value can be an empty string. The value can be up to 128 characters in length, cannot start with aliyun or acs:, and cannot contain http:// or https://. You can specify a maximum of 20 tag values.

Return values

Fn::GetAtt

EndpointGroupId: The ID of the endpoint group.

Examples

Scenario 1: Create a single endpoint group for a GA listener to forward traffic to an SLB instance.

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 为全球加速监听创建单个终端节点组,将流量转发到SLB实例。
  en: Create a single endpoint group for a GA listener to forward traffic to an SLB instance.
Parameters:
  AcceleratorId:
    Type: String
    Label:
      zh-cn: 全球加速实例ID
      en: Accelerator ID
    Description:
      zh-cn: 已有的全球加速实例ID。
      en: The ID of an existing Global Accelerator instance.
  ListenerId:
    Type: String
    Label:
      zh-cn: 监听ID
      en: Listener ID
    Description:
      zh-cn: 全球加速监听器的ID。
      en: The ID of the GA listener.
  EndpointGroupRegion:
    Type: String
    Label:
      zh-cn: 终端节点组地域
      en: Endpoint Group Region
    Description:
      zh-cn: 终端节点组所属的地域ID,即源站所在地域。
      en: The region ID of the endpoint group, where the origin server is located.
    AssociationProperty: ALIYUN::ECS::RegionId
    Default: cn-hangzhou
  SlbInstanceId:
    Type: String
    Label:
      zh-cn: SLB实例ID
      en: SLB Instance ID
    Description:
      zh-cn: 作为终端节点的SLB负载均衡实例ID。
      en: The SLB instance ID to use as an endpoint.
Resources:
  EndpointGroups:
    Type: ALIYUN::GA::EndpointGroups
    Properties:
      AcceleratorId:
        Ref: AcceleratorId
      ListenerId:
        Ref: ListenerId
      EndpointGroupConfigurations:
        - EndpointGroupName: slb-endpoint-group
          EndpointGroupRegion:
            Ref: EndpointGroupRegion
          EndpointGroupType: default
          TrafficPercentage: 100
          EndpointConfigurations:
            - Type: SLB
              Endpoint:
                Ref: SlbInstanceId
              Weight: 100
          HealthCheckEnabled: true
          HealthCheckProtocol: tcp
          HealthCheckIntervalSeconds: 3
          ThresholdCount: 3
Outputs:
  EndpointGroupIds:
    Label:
      zh-cn: 终端节点组ID列表
      en: Endpoint Group IDs
    Description:
      zh-cn: 创建成功的终端节点组ID列表。
      en: The list of created endpoint group IDs.
    Value:
      Fn::GetAtt:
        - EndpointGroups
        - EndpointGroupIds
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "为全球加速监听创建单个终端节点组,将流量转发到SLB实例。",
    "en": "Create a single endpoint group for a GA listener to forward traffic to an SLB instance."
  },
  "Parameters": {
    "AcceleratorId": {
      "Type": "String",
      "Label": {
        "zh-cn": "全球加速实例ID",
        "en": "Accelerator ID"
      },
      "Description": {
        "zh-cn": "已有的全球加速实例ID。",
        "en": "The ID of an existing Global Accelerator instance."
      }
    },
    "ListenerId": {
      "Type": "String",
      "Label": {
        "zh-cn": "监听ID",
        "en": "Listener ID"
      },
      "Description": {
        "zh-cn": "全球加速监听器的ID。",
        "en": "The ID of the GA listener."
      }
    },
    "EndpointGroupRegion": {
      "Type": "String",
      "Label": {
        "zh-cn": "终端节点组地域",
        "en": "Endpoint Group Region"
      },
      "Description": {
        "zh-cn": "终端节点组所属的地域ID,即源站所在地域。",
        "en": "The region ID of the endpoint group, where the origin server is located."
      },
      "AssociationProperty": "ALIYUN::ECS::RegionId",
      "Default": "cn-hangzhou"
    },
    "SlbInstanceId": {
      "Type": "String",
      "Label": {
        "zh-cn": "SLB实例ID",
        "en": "SLB Instance ID"
      },
      "Description": {
        "zh-cn": "作为终端节点的SLB负载均衡实例ID。",
        "en": "The SLB instance ID to use as an endpoint."
      }
    }
  },
  "Resources": {
    "EndpointGroups": {
      "Type": "ALIYUN::GA::EndpointGroups",
      "Properties": {
        "AcceleratorId": {
          "Ref": "AcceleratorId"
        },
        "ListenerId": {
          "Ref": "ListenerId"
        },
        "EndpointGroupConfigurations": [
          {
            "EndpointGroupName": "slb-endpoint-group",
            "EndpointGroupRegion": {
              "Ref": "EndpointGroupRegion"
            },
            "EndpointGroupType": "default",
            "TrafficPercentage": 100,
            "EndpointConfigurations": [
              {
                "Type": "SLB",
                "Endpoint": {
                  "Ref": "SlbInstanceId"
                },
                "Weight": 100
              }
            ],
            "HealthCheckEnabled": true,
            "HealthCheckProtocol": "tcp",
            "HealthCheckIntervalSeconds": 3,
            "ThresholdCount": 3
          }
        ]
      }
    }
  },
  "Outputs": {
    "EndpointGroupIds": {
      "Label": {
        "zh-cn": "终端节点组ID列表",
        "en": "Endpoint Group IDs"
      },
      "Description": {
        "zh-cn": "创建成功的终端节点组ID列表。",
        "en": "The list of created endpoint group IDs."
      },
      "Value": {
        "Fn::GetAtt": [
          "EndpointGroups",
          "EndpointGroupIds"
        ]
      }
    }
  }
}

Scenario 2: Create multi-region endpoint groups with HTTP health check and port override.

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 批量创建多地域终端节点组,配置HTTP健康检查和端口映射。
  en: Create multi-region endpoint groups with HTTP health check and port override.
Parameters:
  AcceleratorId:
    Type: String
    Label:
      zh-cn: 全球加速实例ID
      en: Accelerator ID
    Description:
      zh-cn: 已有的全球加速实例ID。
      en: The ID of an existing Global Accelerator instance.
  ListenerId:
    Type: String
    Label:
      zh-cn: 监听ID
      en: Listener ID
    Description:
      zh-cn: 全球加速监听器的ID。
      en: The ID of the GA listener.
  PrimaryAlbId:
    Type: String
    Label:
      zh-cn: 主站ALB实例ID
      en: Primary ALB Instance ID
    Description:
      zh-cn: 杭州地域作为主站的ALB应用型负载均衡实例ID。
      en: The ALB instance ID in Hangzhou as the primary site.
  SecondaryAlbId:
    Type: String
    Label:
      zh-cn: 备站ALB实例ID
      en: Secondary ALB Instance ID
    Description:
      zh-cn: 上海地域作为备站的ALB应用型负载均衡实例ID。
      en: The ALB instance ID in Shanghai as the secondary site.
  PrimaryTrafficPercentage:
    Type: Number
    Label:
      zh-cn: 主站流量比例(%)
      en: Primary Traffic Percentage
    Description:
      zh-cn: 分配到杭州主站的流量比例,剩余流量自动分配到上海备站。
      en: Traffic percentage to the primary Hangzhou site. Remaining goes to Shanghai.
    Default: 80
    MinValue: 0
    MaxValue: 100
Resources:
  EndpointGroups:
    Type: ALIYUN::GA::EndpointGroups
    Properties:
      AcceleratorId:
        Ref: AcceleratorId
      ListenerId:
        Ref: ListenerId
      EndpointGroupConfigurations:
        - EndpointGroupName: primary-hangzhou
          EndpointGroupDescription: 杭州主站终端节点组
          EndpointGroupRegion: cn-hangzhou
          EndpointGroupType: default
          EndpointRequestProtocol: HTTP
          TrafficPercentage:
            Ref: PrimaryTrafficPercentage
          PortOverrides:
            - ListenerPort: 443
              EndpointPort: 80
          EndpointConfigurations:
            - Type: ALB
              Endpoint:
                Ref: PrimaryAlbId
              Weight: 100
          HealthCheckEnabled: true
          HealthCheckProtocol: http
          HealthCheckPort: 80
          HealthCheckPath: /health
          HealthCheckIntervalSeconds: 5
          ThresholdCount: 3
          Tags:
            - Key: Role
              Value: Primary
            - Key: Region
              Value: cn-hangzhou
        - EndpointGroupName: secondary-shanghai
          EndpointGroupDescription: 上海备站终端节点组
          EndpointGroupRegion: cn-shanghai
          EndpointGroupType: default
          EndpointRequestProtocol: HTTP
          TrafficPercentage:
            Fn::Calculate:
              - '{0}-{1}'
              - 0
              - - 100
                - Ref: PrimaryTrafficPercentage
          PortOverrides:
            - ListenerPort: 443
              EndpointPort: 80
          EndpointConfigurations:
            - Type: ALB
              Endpoint:
                Ref: SecondaryAlbId
              Weight: 100
          HealthCheckEnabled: true
          HealthCheckProtocol: http
          HealthCheckPort: 80
          HealthCheckPath: /health
          HealthCheckIntervalSeconds: 5
          ThresholdCount: 3
          Tags:
            - Key: Role
              Value: Secondary
            - Key: Region
              Value: cn-shanghai
Outputs:
  EndpointGroupIds:
    Label:
      zh-cn: 终端节点组ID列表
      en: Endpoint Group IDs
    Description:
      zh-cn: 批量创建的终端节点组ID列表(按配置顺序排列)。
      en: The list of created endpoint group IDs (in configuration order).
    Value:
      Fn::GetAtt:
        - EndpointGroups
        - EndpointGroupIds
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "批量创建多地域终端节点组,配置HTTP健康检查和端口映射。",
    "en": "Create multi-region endpoint groups with HTTP health check and port override."
  },
  "Parameters": {
    "AcceleratorId": {
      "Type": "String",
      "Label": {
        "zh-cn": "全球加速实例ID",
        "en": "Accelerator ID"
      },
      "Description": {
        "zh-cn": "已有的全球加速实例ID。",
        "en": "The ID of an existing Global Accelerator instance."
      }
    },
    "ListenerId": {
      "Type": "String",
      "Label": {
        "zh-cn": "监听ID",
        "en": "Listener ID"
      },
      "Description": {
        "zh-cn": "全球加速监听器的ID。",
        "en": "The ID of the GA listener."
      }
    },
    "PrimaryAlbId": {
      "Type": "String",
      "Label": {
        "zh-cn": "主站ALB实例ID",
        "en": "Primary ALB Instance ID"
      },
      "Description": {
        "zh-cn": "杭州地域作为主站的ALB应用型负载均衡实例ID。",
        "en": "The ALB instance ID in Hangzhou as the primary site."
      }
    },
    "SecondaryAlbId": {
      "Type": "String",
      "Label": {
        "zh-cn": "备站ALB实例ID",
        "en": "Secondary ALB Instance ID"
      },
      "Description": {
        "zh-cn": "上海地域作为备站的ALB应用型负载均衡实例ID。",
        "en": "The ALB instance ID in Shanghai as the secondary site."
      }
    },
    "PrimaryTrafficPercentage": {
      "Type": "Number",
      "Label": {
        "zh-cn": "主站流量比例(%)",
        "en": "Primary Traffic Percentage"
      },
      "Description": {
        "zh-cn": "分配到杭州主站的流量比例,剩余流量自动分配到上海备站。",
        "en": "Traffic percentage to the primary Hangzhou site. Remaining goes to Shanghai."
      },
      "Default": 80,
      "MinValue": 0,
      "MaxValue": 100
    }
  },
  "Resources": {
    "EndpointGroups": {
      "Type": "ALIYUN::GA::EndpointGroups",
      "Properties": {
        "AcceleratorId": {
          "Ref": "AcceleratorId"
        },
        "ListenerId": {
          "Ref": "ListenerId"
        },
        "EndpointGroupConfigurations": [
          {
            "EndpointGroupName": "primary-hangzhou",
            "EndpointGroupDescription": "杭州主站终端节点组",
            "EndpointGroupRegion": "cn-hangzhou",
            "EndpointGroupType": "default",
            "EndpointRequestProtocol": "HTTP",
            "TrafficPercentage": {
              "Ref": "PrimaryTrafficPercentage"
            },
            "PortOverrides": [
              {
                "ListenerPort": 443,
                "EndpointPort": 80
              }
            ],
            "EndpointConfigurations": [
              {
                "Type": "ALB",
                "Endpoint": {
                  "Ref": "PrimaryAlbId"
                },
                "Weight": 100
              }
            ],
            "HealthCheckEnabled": true,
            "HealthCheckProtocol": "http",
            "HealthCheckPort": 80,
            "HealthCheckPath": "/health",
            "HealthCheckIntervalSeconds": 5,
            "ThresholdCount": 3,
            "Tags": [
              {
                "Key": "Role",
                "Value": "Primary"
              },
              {
                "Key": "Region",
                "Value": "cn-hangzhou"
              }
            ]
          },
          {
            "EndpointGroupName": "secondary-shanghai",
            "EndpointGroupDescription": "上海备站终端节点组",
            "EndpointGroupRegion": "cn-shanghai",
            "EndpointGroupType": "default",
            "EndpointRequestProtocol": "HTTP",
            "TrafficPercentage": {
              "Fn::Calculate": [
                "{0}-{1}",
                0,
                [
                  100,
                  {
                    "Ref": "PrimaryTrafficPercentage"
                  }
                ]
              ]
            },
            "PortOverrides": [
              {
                "ListenerPort": 443,
                "EndpointPort": 80
              }
            ],
            "EndpointConfigurations": [
              {
                "Type": "ALB",
                "Endpoint": {
                  "Ref": "SecondaryAlbId"
                },
                "Weight": 100
              }
            ],
            "HealthCheckEnabled": true,
            "HealthCheckProtocol": "http",
            "HealthCheckPort": 80,
            "HealthCheckPath": "/health",
            "HealthCheckIntervalSeconds": 5,
            "ThresholdCount": 3,
            "Tags": [
              {
                "Key": "Role",
                "Value": "Secondary"
              },
              {
                "Key": "Region",
                "Value": "cn-shanghai"
              }
            ]
          }
        ]
      }
    }
  },
  "Outputs": {
    "EndpointGroupIds": {
      "Label": {
        "zh-cn": "终端节点组ID列表",
        "en": "Endpoint Group IDs"
      },
      "Description": {
        "zh-cn": "批量创建的终端节点组ID列表(按配置顺序排列)。",
        "en": "The list of created endpoint group IDs (in configuration order)."
      },
      "Value": {
        "Fn::GetAtt": [
          "EndpointGroups",
          "EndpointGroupIds"
        ]
      }
    }
  }
}

Scenario 3: Create an endpoint group with weighted endpoints, client IP preservation and HTTPS health check.

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 创建多终端节点加权路由的终端节点组,配置客户端源IP保持和HTTPS健康检查。
  en: Create an endpoint group with weighted endpoints, client IP preservation and HTTPS health check.
Parameters:
  AcceleratorId:
    Type: String
    Label:
      zh-cn: 全球加速实例ID
      en: Accelerator ID
    Description:
      zh-cn: 已有的全球加速实例ID。
      en: The ID of an existing Global Accelerator instance.
  ListenerId:
    Type: String
    Label:
      zh-cn: 监听ID
      en: Listener ID
    Description:
      zh-cn: 全球加速监听器的ID。
      en: The ID of the GA listener.
  EndpointGroupRegion:
    Type: String
    Label:
      zh-cn: 终端节点组地域
      en: Endpoint Group Region
    Description:
      zh-cn: 终端节点组所属的地域ID。
      en: The region ID of the endpoint group.
    AssociationProperty: ALIYUN::ECS::RegionId
    Default: cn-hangzhou
  PrimarySlbId:
    Type: String
    Label:
      zh-cn: 主SLB实例ID
      en: Primary SLB Instance ID
    Description:
      zh-cn: 作为主要终端节点的SLB实例ID,承载大部分流量。
      en: The primary SLB instance ID, handling most of the traffic.
  SecondaryEcsIp:
    Type: String
    Label:
      zh-cn: 备用ECS公网IP
      en: Secondary ECS Public IP
    Description:
      zh-cn: 作为备用终端节点的ECS实例公网IP地址。
      en: The public IP of the secondary ECS instance.
  HealthCheckPath:
    Type: String
    Label:
      zh-cn: 健康检查路径
      en: Health Check Path
    Description:
      zh-cn: HTTPS健康检查的URL路径,需返回200状态码表示健康。
      en: HTTPS health check URL path. Must return 200 to indicate healthy.
    Default: /health
  HealthCheckPort:
    Type: Number
    Label:
      zh-cn: 健康检查端口
      en: Health Check Port
    Description:
      zh-cn: 健康检查使用的端口号。
      en: The port number for health checks.
    Default: 443
    MinValue: 1
    MaxValue: 65535
Resources:
  EndpointGroups:
    Type: ALIYUN::GA::EndpointGroups
    Properties:
      AcceleratorId:
        Ref: AcceleratorId
      ListenerId:
        Ref: ListenerId
      EndpointGroupConfigurations:
        - EndpointGroupName: weighted-multi-endpoint
          EndpointGroupDescription: 多终端节点加权路由,SLB为主、ECS为备
          EndpointGroupRegion:
            Ref: EndpointGroupRegion
          EndpointGroupType: default
          EndpointRequestProtocol: HTTPS
          TrafficPercentage: 100
          EnableClientIPPreservationToa: true
          PortOverrides:
            - ListenerPort: 443
              EndpointPort: 443
          EndpointConfigurations:
            - Type: SLB
              Endpoint:
                Ref: PrimarySlbId
              Weight: 200
            - Type: PublicIp
              Endpoint:
                Ref: SecondaryEcsIp
              Weight: 50
          HealthCheckEnabled: true
          HealthCheckProtocol: https
          HealthCheckPort:
            Ref: HealthCheckPort
          HealthCheckPath:
            Ref: HealthCheckPath
          HealthCheckIntervalSeconds: 5
          ThresholdCount: 3
          Tags:
            - Key: Routing
              Value: Weighted
            - Key: IPPreservation
              Value: TOA
Outputs:
  EndpointGroupIds:
    Label:
      zh-cn: 终端节点组ID列表
      en: Endpoint Group IDs
    Description:
      zh-cn: 创建成功的终端节点组ID列表。
      en: The list of created endpoint group IDs.
    Value:
      Fn::GetAtt:
        - EndpointGroups
        - EndpointGroupIds
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "创建多终端节点加权路由的终端节点组,配置客户端源IP保持和HTTPS健康检查。",
    "en": "Create an endpoint group with weighted endpoints, client IP preservation and HTTPS health check."
  },
  "Parameters": {
    "AcceleratorId": {
      "Type": "String",
      "Label": {
        "zh-cn": "全球加速实例ID",
        "en": "Accelerator ID"
      },
      "Description": {
        "zh-cn": "已有的全球加速实例ID。",
        "en": "The ID of an existing Global Accelerator instance."
      }
    },
    "ListenerId": {
      "Type": "String",
      "Label": {
        "zh-cn": "监听ID",
        "en": "Listener ID"
      },
      "Description": {
        "zh-cn": "全球加速监听器的ID。",
        "en": "The ID of the GA listener."
      }
    },
    "EndpointGroupRegion": {
      "Type": "String",
      "Label": {
        "zh-cn": "终端节点组地域",
        "en": "Endpoint Group Region"
      },
      "Description": {
        "zh-cn": "终端节点组所属的地域ID。",
        "en": "The region ID of the endpoint group."
      },
      "AssociationProperty": "ALIYUN::ECS::RegionId",
      "Default": "cn-hangzhou"
    },
    "PrimarySlbId": {
      "Type": "String",
      "Label": {
        "zh-cn": "主SLB实例ID",
        "en": "Primary SLB Instance ID"
      },
      "Description": {
        "zh-cn": "作为主要终端节点的SLB实例ID,承载大部分流量。",
        "en": "The primary SLB instance ID, handling most of the traffic."
      }
    },
    "SecondaryEcsIp": {
      "Type": "String",
      "Label": {
        "zh-cn": "备用ECS公网IP",
        "en": "Secondary ECS Public IP"
      },
      "Description": {
        "zh-cn": "作为备用终端节点的ECS实例公网IP地址。",
        "en": "The public IP of the secondary ECS instance."
      }
    },
    "HealthCheckPath": {
      "Type": "String",
      "Label": {
        "zh-cn": "健康检查路径",
        "en": "Health Check Path"
      },
      "Description": {
        "zh-cn": "HTTPS健康检查的URL路径,需返回200状态码表示健康。",
        "en": "HTTPS health check URL path. Must return 200 to indicate healthy."
      },
      "Default": "/health"
    },
    "HealthCheckPort": {
      "Type": "Number",
      "Label": {
        "zh-cn": "健康检查端口",
        "en": "Health Check Port"
      },
      "Description": {
        "zh-cn": "健康检查使用的端口号。",
        "en": "The port number for health checks."
      },
      "Default": 443,
      "MinValue": 1,
      "MaxValue": 65535
    }
  },
  "Resources": {
    "EndpointGroups": {
      "Type": "ALIYUN::GA::EndpointGroups",
      "Properties": {
        "AcceleratorId": {
          "Ref": "AcceleratorId"
        },
        "ListenerId": {
          "Ref": "ListenerId"
        },
        "EndpointGroupConfigurations": [
          {
            "EndpointGroupName": "weighted-multi-endpoint",
            "EndpointGroupDescription": "多终端节点加权路由,SLB为主、ECS为备",
            "EndpointGroupRegion": {
              "Ref": "EndpointGroupRegion"
            },
            "EndpointGroupType": "default",
            "EndpointRequestProtocol": "HTTPS",
            "TrafficPercentage": 100,
            "EnableClientIPPreservationToa": true,
            "PortOverrides": [
              {
                "ListenerPort": 443,
                "EndpointPort": 443
              }
            ],
            "EndpointConfigurations": [
              {
                "Type": "SLB",
                "Endpoint": {
                  "Ref": "PrimarySlbId"
                },
                "Weight": 200
              },
              {
                "Type": "PublicIp",
                "Endpoint": {
                  "Ref": "SecondaryEcsIp"
                },
                "Weight": 50
              }
            ],
            "HealthCheckEnabled": true,
            "HealthCheckProtocol": "https",
            "HealthCheckPort": {
              "Ref": "HealthCheckPort"
            },
            "HealthCheckPath": {
              "Ref": "HealthCheckPath"
            },
            "HealthCheckIntervalSeconds": 5,
            "ThresholdCount": 3,
            "Tags": [
              {
                "Key": "Routing",
                "Value": "Weighted"
              },
              {
                "Key": "IPPreservation",
                "Value": "TOA"
              }
            ]
          }
        ]
      }
    }
  },
  "Outputs": {
    "EndpointGroupIds": {
      "Label": {
        "zh-cn": "终端节点组ID列表",
        "en": "Endpoint Group IDs"
      },
      "Description": {
        "zh-cn": "创建成功的终端节点组ID列表。",
        "en": "The list of created endpoint group IDs."
      },
      "Value": {
        "Fn::GetAtt": [
          "EndpointGroups",
          "EndpointGroupIds"
        ]
      }
    }
  }
}