Todos os produtos
Search
Central de documentação

Resource Orchestration Service:ALIYUN::GA::EndpointGroup

Última atualização: Jul 24, 2026

O resource ALIYUN::GA::EndpointGroup cria um grupo de endpoints.

Sintaxe

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

Propriedades

Propriedade Tipo Obrigatório Editável Descrição Restrições
AcceleratorId String Sim Não ID da instância do Global Accelerator. Nenhuma
EndpointConfigurations List Sim Sim Os endpoints. É possível especificar no máximo quatro endpoints.

Para mais informações, consulte EndpointConfigurations properties.

EndpointGroupRegion String Sim Não Região onde o grupo de endpoints está implantado. Nenhuma
ListenerId String Sim Não ID do listener. Nenhuma
Description String Não Sim Descrição do grupo de endpoints. Nenhuma
EndpointGroupType String Não Não Tipo do grupo de endpoints. Valores válidos:
  • default (padrão): grupo de endpoints padrão.
  • virtual: grupo de endpoints virtual.
Nota Apenas listeners que utilizam HTTP ou HTTPS suportam grupos de endpoints virtuais.
EndpointIpVersion String Não Sim Protocolo de endereço IP de backend. Valores válidos:
  • IPv4 (padrão): o GA utiliza apenas endereços IPv4 para se comunicar com o service de endpoint.
  • IPv6: o GA utiliza apenas endereços IPv6 para se comunicar com o service de endpoint.
  • ProtocolAffinity: o GA se comunica com o service de endpoint usando o mesmo protocolo IP da solicitação do cliente.
EndpointProtocolVersion String Não Sim Versão do protocolo do service de backend. Valores válidos:
  • HTTP1.1 (padrão): HTTP 1.1.
  • HTTP2: HTTP/2.

Este parâmetro está disponível somente quando EndpointRequestProtocol (protocolo do service de backend) estiver definido como HTTPS.

EndpointRequestProtocol String Não Sim Protocolo do service de backend. Valores válidos:
  • HTTP (padrão)
  • HTTPS
Nota
  • Este parâmetro está disponível apenas ao criar um grupo de endpoints para um listener que usa HTTP ou HTTPS.
  • Para um listener HTTP, o protocolo do service de backend deve ser HTTP.
HealthCheckEnabled Boolean Não Sim Defina se o recurso de verificação de integridade deve ser ativado. Valores válidos:
  • true (padrão): ativa o recurso de verificação de integridade.
  • false: desativa o recurso de verificação de integridade.
HealthCheckHost String Não Sim Nome de domínio para a verificação de integridade. Nenhuma
HealthCheckIntervalSeconds Integer Não Sim Intervalo entre as verificações de integridade. Unidade: segundos.
HealthCheckPath String Não Sim Caminho para a verificação de integridade. Nenhuma
HealthCheckPort Integer Não Sim Porta usada para a verificação de integridade. Nenhuma
HealthCheckProtocol String Não Sim Protocolo para a verificação de integridade. Valores válidos:
  • tcp: TCP.
  • http: HTTP.
  • https: HTTPS.
Name String Não Sim Nome do grupo de endpoints. Nenhuma
PortOverrides List Não Sim Mapeamentos de porta. Para mais informações, consulte PortOverrides properties.
Tags List Não Não Tags do grupo de endpoints. Para mais informações, consulte Tags properties.
ThresholdCount Integer Não Sim Número de falhas consecutivas na verificação de integridade necessárias para considerar um endpoint como não íntegro. Nenhuma
TrafficPercentage Integer Não Sim Peso do grupo de endpoints quando o listener está associado a vários grupos de endpoints. Nenhuma

Sintaxe de EndpointConfigurations

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

Propriedades de EndpointConfigurations

Propriedade Tipo Obrigatório Editável Descrição Restrições
Endpoint String Sim Sim Endereço IP ou nome de domínio do endpoint. Nenhuma
Type String Sim Sim Tipo do endpoint. Valores válidos:
  • Domain: nome de domínio personalizado.
  • Ip: endereço IP personalizado.
Weight Integer Sim Sim Peso do endpoint. Nenhuma
EnableClientIPPreservation Boolean Não Sim Defina se os endereços IP de source do cliente devem ser preservados. Valores válidos:
  • true: preserva os endereços IP de source do cliente.
  • false (padrão): não preserva os endereços IP de source do cliente.
EnableProxyProtocol Boolean Não Sim Defina se o módulo TCP Option Address (TOA) recupera o endereço IP do cliente que acessa o endpoint. Nenhuma
SubAddress String Não Sim Endereço IP privado da interface de rede elástica (ENI). Este parâmetro é opcional quando o tipo de endpoint é ENI. Se não for especificado, o endereço IP privado principal da ENI será utilizado.
VpcId String Não Sim ID da VPC. Nenhuma
VSwitchIds List Não Sim Lista de IDs de vSwitch na VPC. É possível especificar no máximo 2 IDs de vSwitch.

Sintaxe de PortOverrides

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

Propriedades de PortOverrides

Propriedade Tipo Obrigatório Editável Descrição Restrições
EndpointPort Integer Sim Sim Porta do endpoint para mapeamento de portas. Nenhuma
ListenerPort Integer Sim Sim Porta do listener para mapeamento de portas. Para listeners TCP:
  • Grupos de endpoints virtuais não suportam mapeamento de portas.
  • Se já existir um grupo de endpoints virtual no listener, o grupo de endpoints padrão não poderá ser configurado com mapeamento de portas.
  • Se o grupo de endpoints padrão já estiver configurado com mapeamento de portas, não será possível adicionar um grupo de endpoints virtual.
  • Após configurar o mapeamento de portas, aplicam-se as seguintes restrições ao modificar o listener:
    • Alterações de protocolo não são suportadas, exceto entre HTTP e HTTPS.
    • Porta do listener: o intervalo de portas do listener que você modifique deve incluir todas as portas do listener atualmente configuradas no mapeamento de portas. Por exemplo, se o intervalo de portas do listener for 80-82 e o mapeamento de portas estiver configurado para as portas de endpoint 100-102, o intervalo de portas do listener não poderá ser alterado para 80-81.

Sintaxe de Tags

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

Propriedades de Tags

Propriedade

Tipo

Obrigatório

Editável

Descrição

Restrições

Key

String

Sim

Não

Chave da tag do grupo de endpoints.

Uma vez especificada, o valor não pode ser uma string vazia. A chave pode ter até 64 caracteres, não pode começar com aliyun ou acs: e não pode conter http:// ou https://. É possível especificar no máximo 20 chaves de tag.

Value

String

Não

Não

Valor da tag do grupo de endpoints.

Quando especificado, o valor pode ser uma string vazia. O valor pode ter até 128 caracteres, não pode começar com aliyun ou acs: e não pode conter http:// ou https://. É possível especificar no máximo 20 valores de tag.

Valores de retorno

Fn::GetAtt

EndpointGroupId: ID do grupo de endpoints.

Exemplos

Cenário 1: Crie um único grupo de endpoints para um listener GA visando encaminhar tráfego para uma instância SLB.

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

Cenário 2: Crie grupos de endpoints multirregião com verificação de integridade HTTP e substituição de porta.

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

Cenário 3: Crie um grupo de endpoints com endpoints ponderados, preservação de IP do cliente e verificação de integridade HTTPS.

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