SetRule
Modifies the forwarding rule of a target vServer group.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
slb:SetRule |
update |
*loadbalancer
|
|
None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
The region ID of the SLB instance. You can call the DescribeRegions operation to query the region ID. |
cn-hangzhou |
| RuleId |
string |
Yes |
The ID of the forwarding rule. |
rule-3ejhkt**** |
| VServerGroupId |
string |
No |
The ID of the target vServer group for the forwarding rule. |
rsp-cige6**** |
| RuleName |
string |
No |
The name of the forwarding rule. The name must be 1 to 40 characters in length and can contain Chinese characters, letters, digits, hyphens (-), forward slashes (/), periods (.), and underscores (_). Note
The names of different rules within the same listener must be unique. |
doctest |
| ListenerSync |
string |
No |
Specifies whether to inherit the health check, session persistence, and scheduling algorithm configurations from the listener. Valid values:
|
off |
| Scheduler |
string |
No |
The scheduling algorithm. Valid values:
Note
This parameter is required and takes effect only when ListenerSync is set to off. |
wrr |
| StickySession |
string |
No |
Specifies whether to enable session persistence. Valid values:
This parameter is required and takes effect only when ListenerSync is set to off. |
off |
| StickySessionType |
string |
No |
The method used to handle cookies. Valid values:
Note
This parameter is required and takes effect only when StickySession is set to on. |
insert |
| CookieTimeout |
integer |
No |
The timeout period of the cookie. Unit: seconds. Valid values: 1 to 86400. Note
This parameter is required and takes effect only when StickySession is set to on and StickySessionType is set to insert. |
123 |
| Cookie |
string |
No |
The cookie configured on the server. The cookie must be 1 to 200 characters in length and can contain only ASCII letters and digits. It cannot contain commas (,), semicolons (;), or spaces, and cannot start with a dollar sign ($). Note
This parameter is required and takes effect only when StickySession is set to on and StickySessionType is set to server. |
23ffsa |
| HealthCheck |
string |
No |
Specifies whether to enable the health check. Valid values:
Note
This parameter is required and takes effect only when ListenerSync is set to off. Otherwise, this parameter is ignored. |
off |
| HealthCheckDomain |
string |
No |
The domain name used for health checks. Valid values:
Note
This parameter takes effect only when HealthCheck is set to on. |
$_ip |
| HealthCheckURI |
string |
No |
The URI used for health checks. Note
This parameter is required and takes effect only when HealthCheck is set to on. |
/example |
| HealthyThreshold |
integer |
No |
The number of consecutive successful health checks that must occur before the health check status of a backend server is changed from Failed to Successful. Valid values: 2 to 10. Note
This parameter is required and takes effect only when HealthCheck is set to on. |
4 |
| UnhealthyThreshold |
integer |
No |
The number of consecutive failed health checks that must occur before the health check status of a backend server is changed from Successful to Failed. Valid values: 2 to 10. Note
This parameter is required and takes effect only when HealthCheck is set to on. |
4 |
| HealthCheckTimeout |
integer |
No |
The timeout period for receiving a response from a health check. If the backend ECS instance does not respond correctly within the specified time, the health check is considered failed. Unit: seconds. Valid values: 1 to 300. Note
This parameter is required and takes effect only when HealthCheck is set to on. |
20 |
| HealthCheckInterval |
integer |
No |
The interval between two consecutive health checks. Unit: seconds. Valid values: 1 to 50. Note
This parameter is required and takes effect only when HealthCheck is set to on. |
20 |
| HealthCheckConnectPort |
integer |
No |
The port used for health checks. Valid values: 1 to 65535. Note
This parameter takes effect only when HealthCheck is set to on. |
80 |
| HealthCheckHttpCode |
string |
No |
The HTTP status codes that indicate a successful health check. Separate multiple HTTP status codes with commas (,). Valid values: http_2xx, http_3xx, http_4xx, and http_5xx. Note
This parameter is required and takes effect only when HealthCheck is set to on. |
http_2xx |
| DryRun |
boolean |
No |
Specifies whether to only precheck this request. Valid values:
|
false |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The ID of the request. |
9DEC9C28-AB05-4DDF-9A78-6B08EC9CE18C |
Examples
Success response
JSON format
{
"RequestId": "9DEC9C28-AB05-4DDF-9A78-6B08EC9CE18C"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidParameter | The specified VServerGroupId does not belong to the LoadBalancerId of the rule. | The Vgw ip is empty. Specify the Vgw ip parameter. |
| 400 | InvalidParameter.RegionNotSupport | The region does not support the parameter: %s. | The specified parameter is not supported in the current region. |
| 400 | DryRunOperation | Request validation has been passed with DryRun flag set. | Request validation has been passed with DryRun flag set. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.