All Products
Search
Document Center

Elastic Compute Service:ModifyPrefixList

Last Updated:Aug 21, 2026

Modifies the name, description, and other attributes of a specified prefix list, and supports adding, modifying, and deleting entries.

Operation description

Operation description

  • The specified Classless Inter-Domain Routing (CIDR) blocks must be in standard form. For example, 10.0.0.0/8 is a valid CIDR block, whereas 10.0.0.1/8 is a fault form. For more information, see What is CIDR?.

  • When you add or delete entries, you cannot specify duplicate CIDR blocks. Examples:
    • For IPv4 CIDR blocks: You cannot specify two entries that both have the CIDR block 10.0.0.0/8. You cannot specify two entries whose CIDR blocks are 10.0.0.1/32 and 10.0.0.1 respectively because these two CIDR blocks are duplicates.

    • For IPv6 CIDR blocks: You cannot specify two entries whose CIDR blocks are 2001:fd01:0:0:0:0:0:0/32 and 2001:fd01::/32 respectively because these two CIDR blocks are duplicates.

  • The CIDR blocks of entries to be added cannot be the same as those of entries to be deleted. For example, when you add an entry whose CIDR block is 10.0.0.0/8, the entries to be deleted cannot contain the CIDR block 10.0.0.0/8.

  • To modify the description of an entry, specify the CIDR block of the entry (AddEntry.N.Cidr) and the new description (AddEntry.N.Description).

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

ecs:ModifyPrefixList

update

*PrefixList

acs:ecs:{#regionId}:{#accountId}:prefixlist/{#PrefixListId}

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The region ID. You can call DescribeRegions to query the most recent region list.

cn-chengdu

PrefixListId

string

Yes

The prefix list ID.

pl-x1j1k5ykzqlixdcy****

PrefixListName

string

No

The name of the prefix list. The name must be 2 to 128 characters in length and must start with a letter or a Chinese character. It cannot start with http://, https://, com.aliyun, or com.alibabacloud. It can contain letters, Chinese characters, digits, colons (:), underscores (_), periods (.), and hyphens (-).

PrefixListNameSample

Description

string

No

The description of the prefix list. The description must be 2 to 256 characters in length and cannot start with http:// or https://.

This is description.

AddEntry

array<object>

No

The information about entries to add to the prefix list.

object

No

The information about entries to add to the prefix list.

Description

string

No

The description of the prefix list entry. The description must be 2 to 32 characters in length and cannot start with http:// or https://. Valid values of N: 0 to 200.

Description Sample 01

Cidr

string

Yes

The Classless Inter-Domain Routing (CIDR) block of the prefix list entry to add. Valid values of N: 0 to 200.

Take note of the following items:

  • The total number of entries in the prefix list cannot exceed the maximum number of entries supported by the prefix list. You can invoke DescribePrefixListAttributes to query the maximum number of entries supported by a specified prefix list.

  • You cannot specify duplicate CIDR block values in the settings.

  • The value of this parameter cannot be the same as the value of RemoveEntry.N.Cidr.

192.168.2.0/24

RemoveEntry

array<object>

No

The information about entries to delete from the prefix list.

object

No

The information about entries to delete from the prefix list.

Cidr

string

Yes

The Classless Inter-Domain Routing (CIDR) block of the prefix list entry to delete. Valid values of N: 0 to 200.

Take note of the following items:

  • You cannot specify duplicate CIDR block values in the settings.

  • The value of this parameter cannot be the same as the value of AddEntry.N.Cidr.

192.168.1.0/24

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

38793DB8-A4B2-4AEC-BFD3-111234E9188D

Examples

Success response

JSON format

{
  "RequestId": "38793DB8-A4B2-4AEC-BFD3-111234E9188D"
}

Error codes

HTTP status code

Error code

Error message

Description

400 MissingParameter %s A parameter is not specified.
400 InvalidParameter.PrefixListName The parameter PrefixListName is not valid. The prefix list name is invalid.
400 InvalidDescription.Malformed The specified Description is wrongly formed.
400 InvalidParameter.CidrDuplicated %s Duplicate CIDR blocks are specified.
400 InvalidParameter.CidrMalformed %s The specified CIDR block is invalid.
400 LimitExceed.MaxEntries The number of entries exceeds the MaxEntries of the specified prefix list. The number of specified entries exceeds the MaxEntries value.
400 LimitExceed.Entry The number of entries added or removed exceeds the limit. The number of entries to add or remove at a time exceeds the upper limit.
400 TaskConflict The operation is too frequent, please wait a moment and try again. Operations are too frequent. Wait a moment and try again.
404 InvalidPrefixListId.NotFound The specified prefix list was not found. The prefix list does not exist.
404 InvalidRegionId.NotFound The specified RegionId does not exist. The specified region ID does not exist.
409 OperationConflict Request was denied due to conflict with a previos request. The requested resource conflicts with a previous request.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.