ALIYUN::NLB::ServerGroup is used to create a server group for a Network Load Balancer (NLB) instance.

Syntax

{
  "Type": "ALIYUN::NLB::ServerGroup",
  "Properties": {
    "ResourceGroupId": String,
    "Scheduler": String,
    "AddressIPVersion": String,
    "Servers": List,
    "PreserveClientIpEnabled": Boolean,
    "ServerGroupType": String,
    "PersistenceEnabled": Boolean,
    "ConnectionDrainEnabled": Boolean,
    "ConnectionDrainTimeout": Integer,
    "PersistenceTimeout": Integer,
    "VpcId": String,
    "HealthCheckConfig": Map,
    "Protocol": String,
    "ServerGroupName": String
  }
}

Properties

Property Type Required Editable Description Constraint
ResourceGroupId String No No The ID of the resource group. None.
Scheduler String No No The scheduling algorithm. Default value: Wrr. Valid values:
  • Wrr: weighted round-robin (WRR). Backend servers that have higher weights receive more requests than backend servers that have lower weights.
  • rr: round-robin (RR). Requests are forwarded to backend servers in sequence.
  • sch: source IP address hashing. Requests from the same source IP address are forwarded to the same backend server.
  • tch: consistent hashing that is based on four factors: source IP address, destination IP address, source port, and destination port. Requests that contain the same information based on the four factors are forwarded to the same backend server.
  • qch: Quick UDP Internet Connection (QUIC) ID hashing. Requests that contain the same QUIC ID are forwarded to the same backend server.
AddressIPVersion String No No The protocol version. Default value: ipv4. Valid values:
  • ipv4: IPv4
  • DualStack: dual stack
Servers List No No The list of servers. For more information, see Servers properties.
PreserveClientIpEnabled Boolean No No Specifies whether to enable client IP preservation. Default value: false. Valid values:
  • true
  • false
ServerGroupType String No No The type of the server group. Default value: Instance. Valid values:
  • Instance: servers. You can add Elastic Compute Service (ECS) instances, Edge Node Service (ENS) instances, and elastic container instances to a server group of this type.
  • Ip: IP addresses. You can add servers to a server group of this type by using the IP addresses of the servers.
PersistenceEnabled Boolean No No Specifies whether to enable session persistence. Valid values:
  • true
  • false
ConnectionDrainEnabled Boolean No No Specifies whether to enable connection draining. Default value: false. Valid values:
  • true
  • false
ConnectionDrainTimeout Integer No No The timeout period of connection draining. Unit: seconds.

Valid values: 10 to 900.

PersistenceTimeout Integer No No The timeout period of session persistence. Unit: seconds.

Valid values: 0 to 3600.

VpcId String Yes No The ID of the virtual private cloud (VPC) to which the server group belongs.
Note When you set the ServerGroupType property to Instance, servers can be added to the specified server group only if the servers and the server group are in the same VPC.
HealthCheckConfig Map Yes No The configurations of the health check feature. For more information, see HealthCheckConfig properties.
Protocol String No No The backend protocol. Default value: TCP. Valid values:
  • TCP
  • UDP
  • TCPSSL
ServerGroupName String Yes No The name of the server group. The name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter.

Servers syntax

"Servers": [
  {
    "ServerType": String,
    "Description": String,
    "ServerId": String,
    "ServerIp": String,
    "Port": Integer,
    "Weight": Integer
  }
]

Servers properties

Property Type Required Editable Description Constraint
ServerType String Yes No The type of the backend server. Default value: ecs. Valid values:
  • ecs: ECS instance
  • eni: elastic network interface (ENI) instance
  • eci: elastic container instance
  • ip: IP address
Description String No No The description of the backend server. None.
ServerId String Yes No The ID of the instance that is used as the backend server. Valid values:
  • the ID of the ECS instance
  • the ID of the ENI instance
  • the ID of the elastic container instance
Note The ServerType property is required if you set the ServerId property to the ID of the ENI instance or the elastic container instance.
ServerIp String No No The IP address of the ECS instance, ENI instance, or elastic container instance. None.
Port Integer Yes No The backend port that is used to receive requests. None.
Weight Integer No No The weight of the backend server. Valid values: 0 to 100.

Default value: 100.

HealthCheckConfig syntax

"HealthCheckConfig": {
  "HealthCheckInterval": Integer,
  "HealthCheckUrl": String,
  "HealthCheckConnectPort": Integer,
  "UnhealthyThreshold": Integer,
  "HttpCheckMethod": String,
  "HealthyThreshold": Integer,
  "HealthCheckConnectTimeout": Integer,
  "HealthCheckDomain": String,
  "HealthCheckEnabled": Boolean,
  "HealthCheckHttpCode": List,
  "HealthCheckType": String
}

HealthCheckConfig properties

Property Type Required Editable Description Constraint
HealthCheckInterval Integer No No The interval between consecutive health checks. Unit: seconds.

Valid values: 5 to 50.

Default value: 10.
HealthCheckUrl String No No The path based on which the system performs health checks. The path must be 1 to 80 characters in length, and can contain only letters, digits, the - / . % ? # & = special characters, and the _ ; ~ ! ( ) * [ ] @ $ ^ : ' , + extended characters. The path must start with a forward slash (/).
Note This property takes effect when you set the HealthCheckType property to HTTP.
HealthCheckConnectPort Integer No No The port that you want to use for health checks on backend servers. Valid values: 0 to 65535.

Default value: 0. This value indicates that the port of a backend server is used for health checks.

UnhealthyThreshold Integer No No The number of times that a healthy backend server must consecutively fail health checks before it is declared unhealthy. When this number is reached, the health check status is changed from successful to failed. Valid values: 2 to 10.

Default value: 2.

HttpCheckMethod String Yes No The method that you want to use for health checks. Default value: GET. Valid values:
  • GET
  • HEAD
Note This property takes effect when you set the HealthCheckType property to HTTP.
HealthyThreshold Integer No No The number of times that an unhealthy backend server must consecutively pass health checks before it is declared healthy. When this number is reached, the health check status is changed from failed to successful. Valid values: 2 to 10.

Default value: 2.

HealthCheckConnectTimeout Integer No No The maximum timeout period of a health check response. Unit: seconds.

Valid values: 1 to 300.

Default value: 5.
HealthCheckDomain String No No The domain name that you want to use for health checks. Valid values:
  • $SERVER_IP: the private IP address of a backend server.
  • domain: the domain name that you specify. The domain name must be 1 to 80 characters in length, and can contain only lowercase letters, digits, hyphens (-), and periods (.).
Note This property takes effect when you set the HealthCheckType property to HTTP.
HealthCheckEnabled Boolean No No Specifies whether to enable the health check feature. Default value: true. Valid values:
  • true
  • false
HealthCheckHttpCode List No No The HTTP status codes that the system returns for health checks.

Separate multiple HTTP status codes with commas (,).

Default value: http_2xx. Valid values:
  • http_2xx
  • http_3xx
  • http_4xx
  • http_5xx
Note This property takes effect when you set the HealthCheckType property to HTTP.
HealthCheckType String No No The protocol that you want to use for health checks. Default value: TCP. Valid values:
  • TCP
  • HTTP

Return values

Fn::GetAtt

ServerGroupId: the ID of the server group.

Examples

JSON format

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "VpcId": {
      "Type": "String",
      "Description": "ID of VPC"
    },
    "HealthCheckConfig": {
      "Type": "Json",
      "Description": "Health Check Config"
    },
    "ServerGroupName": {
      "Type": "String",
      "Description": "Name of ServerGroup"
    }
  },
  "Resources": {
    "ExtensionResource": {
      "Type": "ALIYUN::NLB::ServerGroup",
      "Properties": {
        "VpcId": {
          "Ref": "VpcId"
        },
        "HealthCheckConfig": {
          "Ref": "HealthCheckConfig"
        },
        "ServerGroupName": {
          "Ref": "ServerGroupName"
        }
      }
    }
  },
  "Outputs": {
    "ServerGroupId": {
      "Description": "ID of ServerGroup",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "ServerGroupId"
        ]
      }
    }
  }
}