Creates forwarding rules for an HTTP or HTTPS listener.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
slb:CreateRules |
create |
*loadbalancer
|
|
None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
The ID of the region where the Server Load Balancer (SLB) instance is deployed. You can call the DescribeRegions operation to query the most recent region list. |
cn-hangzhou |
| LoadBalancerId |
string |
Yes |
The ID of the SLB instance. |
lb-bp1ca0zt07t934w****** |
| ListenerPort |
integer |
Yes |
The frontend listener port that is used by the SLB instance. Valid values: 1 to 65535. |
443 |
| ListenerProtocol |
string |
No |
The frontend protocol that is used by the SLB instance. Note
This parameter is required if the same port is used by listeners that use different protocols. |
https |
| RuleList |
string |
Yes |
The forwarding rules that you want to create. You can create at most 10 forwarding rules in each call. Each forwarding rule contains the following parameters:
Note
You must specify at least one between the |
[{"RuleName":"Rule2","Domain":"test.com","VServerGroupId":"rsp-bp114ni******"}] |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
9DEC9C28-AB05-4DDF-9A78-6B08EC9CE18C |
| Rules |
object |
||
| Rule |
array<object> |
The forwarding rules. |
|
|
object |
|||
| RuleName |
string |
The name of the forwarding rule. |
Rule2 |
| RuleId |
string |
The forwarding rule ID. |
rule-bp12jzy0***** |
Examples
Success response
JSON format
{
"RequestId": "9DEC9C28-AB05-4DDF-9A78-6B08EC9CE18C",
"Rules": {
"Rule": [
{
"RuleName": "Rule2",
"RuleId": "rule-bp12jzy0*****"
}
]
}
}
Error response
JSON format
{"Code":"InvalidParameter","Message":"The specified parameter is not valid.","HostId":"slb-pop.aliyuncs.com","RequestId":"0669D684-69D8-408E-A4FA-B9011E0F4E66"}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidParameter | The specified VServerGroupId does not belong to the LoadBalancerId of the rule. | |
| 400 | InvalidParameterValue.RegionNotSupport | The region does not support the parameter value, %s. | |
| 400 | TooManyListeners | More than 1 listener is found, please be more specified. | |
| 400 | DomainExist | rule with same domain and url already exists in specified vip | The specified domain name and URL already exists in another listener rule. |
| 400 | OperationFailed.ListenerStatusNotSupport | The status of the listener does not support this operation. Please try again later. | |
| 400 | OperationFailed.ActionNotSupport | The loadbalancer does not support such action. | |
| 400 | MissingParameter.RuleName | The parameter RuleName is required. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.