Creates an endpoint group.

Description

  • CreateEndpointGroup is an asynchronous operation. After you send a request, the system returns the ID of an endpoint group, but the endpoint group is still being created in the system background. You can call the DescribeEndpointGroup operation to query the state of the endpoint group.
    • If the endpoint group is in the init state, it indicates that the endpoint group is being created. In this case, you can perform only query operations.
    • If the endpoint group is in the active state, it indicates that the endpoint group is created.
  • The CreateEndpointGroup operation cannot be repeatedly called for the same Global Accelerator (GA) instance within a specific period of time.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateEndpointGroup

The operation that you want to perform. Set the value to CreateEndpointGroup.

RegionId String Yes cn-hangzhou

The ID of the region where the GA instance is deployed. Set the value to cn-hangzhou.

ClientToken String No 123e4567-e89b-12d3-a456-426655440000

The client token that is used to ensure the idempotence of the request.

You can use the client to generate the value, but you must make sure that it is unique among different requests. ClientToken can contain only ASCII characters.

Note If you do not set this parameter, ClientToken is set to the value of RequestId. The value of RequestId may be different for each API request.
AcceleratorId String Yes ga-bp1odcab8tmno0hdq****

The ID of the GA instance.

Name String No group1

The name of the endpoint group.

The name must be 2 to 128 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). The name must start with a letter.

Description String No EndpointGroup

The description of the endpoint group.

The description cannot exceed 256 characters in length and cannot contain http:// or https://.

EndpointGroupRegion String Yes cn-hangzhou

The ID of the region in which to create the endpoint group.

ListenerId String Yes lsr-bp1bpn0kn908w4nbw****

The ID of the listener.

TrafficPercentage Integer No 20

The traffic ratio for the endpoint group when the specified listener is associated with multiple endpoint groups.

Valid values: 1 to 100.

HealthCheckIntervalSeconds Integer No 3

The interval at which health checks are performed. Unit: seconds.

HealthCheckPath String No /healthcheck

The path to which to send health check requests.

HealthCheckPort Integer No 20

The port that is used for health checks.

HealthCheckProtocol String No tcp

The protocol over which to send health check requests. Valid values:

  • tcp: TCP
  • http: HTTP
  • https: HTTPS
ThresholdCount Integer No 3

The number of consecutive health check failures that must occur before a healthy endpoint group is considered unhealthy, or the number of consecutive health check successes that must occur before an unhealthy endpoint group is considered healthy.

Valid values: 2 to 10. Default value: 3.

EndpointConfigurations.N.Type String Yes Ip

The type of the endpoint. Valid values:

  • Domain: a custom domain name
  • Ip: a custom IP address
  • PublicIp: a public IP address provided by Alibaba Cloud
  • ECS: an Elastic Compute Service (ECS) instance
  • SLB: a Server Load Balancer (SLB) instance
  • ALB: an Application Load Balancer (ALB) instance
  • OSS: an Object Storage Service (OSS) bucket
Note
  • If you set this parameter to ECS or SLB and the service-linked role AliyunServiceRoleForGaVpcEndpoint does not exist, the system automatically creates the service-linked role.
  • If you set this parameter to ALB and the service-linked role AliyunServiceRoleForGaAlb does not exist, the system automatically creates the service-linked role.
  • If you set this parameter to OSS and the service-linked role AliyunServiceRoleForGaOss does not exist, the system automatically creates the service-linked role.

    For more information, see Service-linked roles.

EndpointConfigurations.N.EnableClientIPPreservation Boolean No false

Specifies whether to preserve client IP addresses by using the TCP Option Address (TOA) module. Default value: false. Valid values:

  • true: preserves client IP addresses by using the TOA module.
  • false: does not preserve client IP addresses by using the TOA module.
EndpointConfigurations.N.Weight Integer Yes 20

The weight of the endpoint.

Valid values: 0 to 255.

Note If the weight of an endpoint is set to 0, GA stops distributing network traffic to the endpoint. Proceed with caution.
EndpointConfigurations.N.Endpoint String Yes 120.1.XX.XX

The IP address or domain name of the endpoint.

EndpointRequestProtocol String No HTTP

The protocol that is used by the backend service. Default value: HTTP. Valid values:

  • HTTP
  • HTTPS
Note
  • You can set this parameter only when the listener that is associated with the endpoint group uses HTTP or HTTPS.
  • For an HTTP listener, the backend service protocol must be HTTP.
EndpointGroupType String No default

The type of the endpoint group. Default value: default. Valid values:

  • default: a default endpoint group.
  • virtual: a virtual endpoint group.
Note Only HTTP and HTTPS listeners support virtual endpoint groups.
PortOverrides.N.ListenerPort Integer No 443

The listener port that is mapped to the endpoint port.

Note
  • Only HTTP and HTTPS listeners support port mappings.
  • The listener port must be the one used by the current listener.
PortOverrides.N.EndpointPort Integer No 80

The endpoint port that is mapped to the listener port.

HealthCheckEnabled Boolean No true

Specifies whether to enable the health check feature. Default value: true. Valid values:

  • true: enables the health check feature.
  • false: disables the health check feature.

Response parameters

Parameter Type Example Description
EndpointGroupId String epg-bp1dmlohjjz4kqaun****

The ID of the endpoint group.

RequestId String 04F0F334-1335-436C-A1D7-6C044FE73368

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateEndpointGroup
&RegionId=cn-hangzhou
&ClientToken=123e4567-e89b-12d3-a456-426655440000    
&AcceleratorId=ga-bp1odcab8tmno0hdq****
&Name=group1
&Description=EndpointGroup
&EndpointGroupRegion=cn-hangzhou
&ListenerId=lsr-bp1bpn0kn908w4nbw****
&TrafficPercentage=20
&HealthCheckIntervalSeconds=3
&HealthCheckPath=/healthcheck
&HealthCheckPort=20
&HealthCheckProtocol=tcp
&ThresholdCount=3
&EndpointConfigurations=[{"Type":"Ip","EnableClientIPPreservation":false,"Weight":20,"Endpoint":"120.1.XX.XX"}]
&EndpointRequestProtocol=HTTP
&EndpointGroupType=default
&PortOverrides=[{"ListenerPort":443,"EndpointPort":80}]
&HealthCheckEnabled=true
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateEndpointGroupResponse>
    <EndpointGroupId>epg-bp1dmlohjjz4kqaun****</EndpointGroupId>
    <RequestId>04F0F334-1335-436C-A1D7-6C044FE73368</RequestId>
</CreateEndpointGroupResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "EndpointGroupId" : "epg-bp1dmlohjjz4kqaun****",
  "RequestId" : "04F0F334-1335-436C-A1D7-6C044FE73368"
}

Error codes

HttpCode Error code Error message Description
400 Domain.NotFit The domain is not fit the rule The error message returned because the domain name does not obtain an ICP number.
400 NotExist.ListenerPort The listening port %s does not exist. The error message returned because the specified listener port %s does not exist.
400 NotExist.Listener The listener does not exist. The error message returned because the specified listener does not exist.
400 NotActive.Listener The state of the listener is not active. The error message returned because the specified listener is unstable.
400 NotExist.Accelerator The accelerated instance does not exist. The error message returned because the specified GA instance does not exist.
400 NotExist.BusinessRegion The business region does not exist. The error message returned because the specified region does not exist.
400 NotExist.BasicBandwidthPackage You must specify the basic bandwidth package. The error message returned because no basic bandwidth plan is specified.
400 QuotaExceeded.EndPoint The maximum number of endpoints is exceeded. The error message returned because the number of endpoints has reached the upper limit.
400 Exist.EndpointGroup The endpoint group already exists. The error message returned because the specified endpoint group already exists.
400 NoPermission.VpcEndpoint You are not authorized to perform the operation. The error message returned because you are not authorized to create the service-linked role. Contact the owner of the Alibaba Cloud account or the administrator to attach the AliyunGlobalAccelerationFullAccess policy or a custom permission policy that grants the permissions to create the required service-linked role to your RAM user. In the custom policy, the service name must be set to vpcendpoint.ga.aliyuncs.com, the service-linked role to AliyunServiceRoleForGaVpcEndpoint, and the permissions to ram:CreateServiceLinkedRole.
400 QuotaExceeded.PortOverride The number of port override exceeds the limit. The error message returned because the number of port mappings has reached the upper limit.

For a list of error codes, visit the API Error Center.