All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::NLB::ServerGroup

Last Updated:Oct 24, 2023

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.

Valid values:

  • Wrr (default): 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. Requests that contain the same information based on the following factors are forwarded to the same backend server: source IP address, destination IP address, source port, and destination port.

  • 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.

Valid values:

  • ipv4 (default): IPv4

  • DualStack: dual stack

Servers

List

No

No

The servers.

For more information, see Servers properties.

PreserveClientIpEnabled

Boolean

No

No

Specifies whether to enable client IP preservation.

Valid values:

  • true

  • false (default)

ServerGroupType

String

No

No

The type of the server group.

Valid values:

  • Instance (default): 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.

Valid values:

  • true

  • false (default)

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 ServerGroupType to Instance, you can add servers to the 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.

Valid values:

  • TCP (default)

  • 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.

Valid values:

  • Ecs (default): ECS instance

  • Eni: elastic network interface (ENI)

  • 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 you want to use as the backend server.

Valid values:

  • ID of the ECS instance

  • ID of the ENI

  • ID of the elastic container instance

Note

The ServerType property must be specified when the ServerId property is set to the ID of the ENI or elastic container instance.

ServerIp

String

No

No

The IP address of the ECS instance, ENI, or elastic container instance.

None.

Port

Integer

Yes

No

The backend port that you want to use 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 at which the system performs 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 HealthCheckType is set 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. A value of 0 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.

Valid values: 2 to 10.

Default value: 2.

HttpCheckMethod

String

Yes

No

The method that you want to use for health checks.

Valid values:

  • GET (default)

  • HEAD

Note

This property takes effect when HealthCheckType is set 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.

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 HealthCheckType is set to HTTP.

HealthCheckEnabled

Boolean

No

No

Specifies whether to enable the health check feature.

Valid values:

  • true (default)

  • false

HealthCheckHttpCode

List

No

No

The HTTP status codes that the system returns for health checks.

Separate multiple HTTP status codes with commas (,).

Valid values:

  • http_2xx (default)

  • http_3xx

  • http_4xx

  • http_5xx

Note

This property takes effect when HealthCheckType is set to HTTP.

HealthCheckType

String

No

No

The protocol that you want to use for health checks.

Valid values:

  • Tcp (default)

  • Http

Return values

Fn::GetAtt

ServerGroupId: the ID of the server group.

Examples

YAML 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

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