All Products
Search
Document Center

Server Load Balancer:UpdateRulesAttribute

Last Updated:Dec 18, 2025

Updates the properties of multiple forwarding rules in a batch.

Operation description

UpdateRulesAttribute is an asynchronous operation. After you send a request, the system returns a request ID and runs the task in the background. The properties of the forwarding rules are not updated immediately. You can call the ListRules operation to query the update status of the forwarding rules:

  • If multiple forwarding rules are in the Configuring state, their properties are being updated in a batch.

  • If multiple forwarding rules are in the Available state, their properties are updated.

  • A forwarding rule supports the following maximum number of conditions (RuleConditions) and actions (RuleActions):

    • Conditions: 5 for a Basic Edition instance, 10 for a Standard Edition instance, and 10 for a WAF-enabled instance.

    • Actions: 3 for a Basic Edition instance, 5 for a Standard Edition instance, and 5 for a WAF-enabled instance.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

alb:UpdateRulesAttribute

update

*LoadBalancer

acs:alb:{#regionId}:{#accountId}:loadbalancer/{#LoadBalancerId}

*ServerGroup

acs:alb:{#regionId}:{#accountId}:servergroup/{#ServerGroupId}

None

None

Request parameters

Parameter

Type

Required

Description

Example

ClientToken

string

No

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

Make sure that the client token is unique among different requests. The client token can contain only ASCII characters.

Note

If you do not specify this parameter, the system automatically uses the RequestId of the API request as the ClientToken. The RequestId of each API request is different.

123e4567-e89b-12d3-a456-42665544***

Rules

array<object>

Yes

The list of forwarding rules.

array<object>

Yes

A forwarding rule.

Priority

integer

No

The priority of the forwarding rule.

80

RuleName

string

No

The name of the forwarding rule.

rule_111

RuleActions

array<object>

No

The list of forwarding rule actions.

array<object>

Yes

A forwarding rule action.

FixedResponseConfig

object

No

The configuration of the action to return a fixed response.

Content

string

No

The content.

dssacav

ContentType

string

No

The content type.

text/plain

HttpCode

string

No

The HTTP status code.

200

ForwardGroupConfig

object

No

The configuration of the action to forward requests to server groups.

ServerGroupTuples

array<object>

No

The list of destination server groups.

object

No

A destination server group.

ServerGroupId

string

No

The server group ID.

sgp-3kbj35ay7cvi******

Weight

integer

No

The weight.

100

ServerGroupStickySession

object

No

Session persistence between server groups.

Enabled

boolean

No

Specifies whether to enable session persistence.

true

Timeout

integer

No

The timeout period.

100

InsertHeaderConfig

object

No

The configuration of the action to insert a header.

CoverEnabled

boolean

No

Specifies whether to overwrite the value of a request header.

False

Key

string

No

The HTTP header.

key

Value

string

No

The content of the HTTP header.

value

ValueType

string

No

The value type.

SystemDefined

Order

integer

Yes

The priority.

1

RedirectConfig

object

No

The configuration of the redirection action.

Host

string

No

The destination host to which requests are redirected.

test.alb.com

HttpCode

string

No

The redirection method.

301

Path

string

No

The destination path to which requests are redirected.

/

Port

string

No

The destination port to which requests are redirected.

443

Protocol

string

No

The destination protocol to which requests are redirected.

HTTPS

Query

string

No

The destination query string to which requests are redirected.

${query}

RewriteConfig

object

No

The configuration of the rewrite action.

Host

string

No

The hostname.

${host}

Path

string

No

The path.

/

Query

string

No

The query.

${query}

Type

string

Yes

The type of the forwarding rule action.

ForwardGroup

TrafficLimitConfig

object

No

The throttling configuration.

QPS

integer

No

The number of queries per second (QPS).

1000

PerIpQps

integer

No

The number of QPS for a single IP address.

100

TrafficMirrorConfig

object

No

The traffic mirroring configuration.

TargetType

string

No

The type of the mirror destination.

ForwardGroupMirror

MirrorGroupConfig

object

No

The server groups to which traffic is mirrored.

ServerGroupTuples

array<object>

No

The server groups to which traffic is mirrored.

object

No

A server group to which traffic is mirrored.

ServerGroupId

string

No

The server group ID.

sgp-vlnjo1rhw0vc******

RemoveHeaderConfig

object

No

The configuration for removing a specific HTTP header.

Key

string

No

The key of the HTTP header.

key

CorsConfig

object

No

The cross-origin resource sharing (CORS) configuration.

AllowOrigin

array

No

The allowed origins.

string

No

An allowed origin.

*

AllowMethods

array

No

The allowed HTTP methods for cross-origin requests.

string

No

The allowed HTTP method for cross-origin requests. Valid values:

  • GET

  • POST

  • PUT

  • DELETE

  • HEAD

  • OPTIONS

  • PATCH

GET

AllowHeaders

array

No

The list of headers that are allowed for cross-origin requests.

string

No

A header that is allowed for cross-origin requests.

test

ExposeHeaders

array

No

The list of headers that can be exposed to the client.

string

No

A header that can be exposed to the client.

test

AllowCredentials

string

No

Specifies whether to allow credentials in cross-origin requests.

off

MaxAge

integer

No

The maximum cache duration of preflight requests in the browser.

60

RuleConditions

array<object>

No

The list of forwarding rule conditions.

array<object>

Yes

A forwarding rule condition.

CookieConfig

object

No

The configuration of the cookie-based condition.

Values

array<object>

No

The list of cookie key-value pairs.

object

No

A cookie key-value pair.

Key

string

No

The key of the cookie.

key

Value

string

No

The value of the cookie.

value

HeaderConfig

object

No

The configuration of the header-based condition.

Key

string

No

The key of the HTTP header.

key

Values

array

No

The list of HTTP header values.

string

No

An HTTP header value.

value

HostConfig

object

No

The configuration of the host-based condition.

Values

array

No

The list of hostnames.

string

No

A hostname.

www.example.com

MethodConfig

object

No

The configuration of the method-based condition.

Values

array

No

The list of HTTP request methods.

string

No

An HTTP request method.

PUT

PathConfig

object

No

The configuration of the path-based condition.

Values

array

No

The list of path conditions.

string

No

A path condition.

/test

QueryStringConfig

object

No

The configuration of the query string-based condition.

Values

array<object>

No

The list of query string key-value pairs.

object

No

A query string key-value pair.

Key

string

No

The key of the query string.

account

Value

string

No

The value of the query string.

on

ResponseHeaderConfig

object

No

The configuration of the response header-based condition.

Key

string

No

The key of the response header.

test

Values

array

No

The values of the response header.

string

No

A value of the response header.

value

ResponseStatusCodeConfig

object

No

The configuration of the response status code-based condition.

Values

array

No

The response status codes.

string

No

A response status code.

200

Type

string

No

The type of the condition.

Header

SourceIpConfig

object

No

The configuration for matching service traffic based on the source IP address.

Values

array

No

One or more IP addresses or CIDR blocks.

string

No

An IP address or a CIDR block.

192.168.1.1

RuleId

string

Yes

The forwarding rule ID.

rule-n4hfecmmtmfl******

DryRun

boolean

No

Specifies whether to perform a dry run. Valid values:

  • true: performs a dry run. The system checks the required parameters, request format, and service limits. If the request fails the dry run, an error message is returned. If the request passes the dry run, the DryRunOperation error code is returned. In this case, the properties of the forwarding rules are not updated.

  • false (default): sends a normal request. After the request passes the check, the system returns an HTTP 2xx status code and starts the update.

false

Response elements

Element

Type

Description

Example

object

Response schema

RequestId

string

The request ID.

365F4154-92F6-4AE4-92F8-7FF34B540710

JobId

string

The ID of the asynchronous task.

72dcd26b-f12d-4c27-b3af-18f6aed5****

Examples

Success response

JSON format

{
  "RequestId": "365F4154-92F6-4AE4-92F8-7FF34B540710",
  "JobId": "72dcd26b-f12d-4c27-b3af-18f6aed5****"
}

Error codes

HTTP status code

Error code

Error message

Description

400

OperationDenied.IpGroupCanNotUsedForMirrorAction

The operation is not allowed because of %s.

The operation is not allowed because of %s.

400

IncorrectStatus.Rule

The status of %s [%s] is incorrect.

400

OperationDenied.SameGroupForForwardAndMirrorAction

The operation is not allowed because of %s.

The operation is not allowed because of %s.

400

OperationDenied.GRPCServerGroup

The operation is not allowed because of %s.

400

Conflict.Priority

There is already %s having the same configuration with %s.

400

ResourceQuotaExceeded.ServerGroupAttachedNum

The quota of %s is exceeded for resource %s, usage %s/%s.

400

ResourceQuotaExceeded.LoadBalancerServersNum

The quota of %s is exceeded for resource %s, usage %s/%s.

400

ResourceQuotaExceeded.ServerAddedNum

The quota of %s is exceeded for resource %s, usage %s/%s.

400

QuotaExceeded.RuleWildcardsNum

The quota of %s is exceeded, usage %s/%s.

The quota of %s is exceeded, usage %s/%s.

400

QuotaExceeded.RuleMatchEvaluationsNum

The quota of %s is exceeded, usage %s/%s.

400

QuotaExceeded.RuleActionsNum

The quota of %s is exceeded, usage %s/%s.

The quota of %s is exceeded. Usage: %s/%s.

400

Mismatch.Protocol

The %s is mismatched for %s and %s.

The %s is mismatched for %s and %s.

400

Mismatch.VpcId

The %s is mismatched for %s and %s.

The %s is mismatched for %s and %s.

400

OperationDenied.ServiceManagedResource

The operation is not allowed because the current resource of %s is managed resource.

400

OperationDenied.ListenerIdInconsistent

The operation is not allowed because of ListenerIdInconsistent.

400

IllegalParam.Priority

The param of Priority is illegal.

400

OperationDenied.MirrorActionSupportHttpGroupOnly

The operation is not allowed because of MirrorActionSupportHttpGroupOnly.

400

OperationDenied.ProtocolMustSameForForwardGroupAction

The operation is not allowed because of ProtocolMustSameForForwardGroupAction.

404

ResourceNotFound.Rule

The specified resource %s is not found.

The specified resource %s is not found.

404

ResourceNotFound.ServerGroup

The specified resource %s is not found.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.