A prefix list is a collection of CIDR blocks that you can reference in network rules for other resources. Using a prefix list simplifies rule management by eliminating the need to create separate rules for each CIDR block. This topic shows you how to create and manage prefix lists.
Create a prefix list
ECS console
Go to ECS Console - Prefix List.
In the upper-left corner of the page, select a region and resource group.
On the Prefix Lists tab, click Create Prefix List.
In the Create Prefix List dialog box, configure the parameters for the prefix list.
Parameter
Description
Prefix list name
Enter a name for the prefix list.
Description
Enter a description for the prefix list. We recommend that you describe its intended purpose.
Address family
Select the IPv4 or IPv6 address family. You cannot change the address family after the prefix list is created.
If you select IPv4, you can add only IPv4 CIDR blocks.
If you select IPv6 Supported, you can add only IPv6 CIDR blocks.
Max entries
Specify the maximum number of entries that the prefix list can contain. You cannot change this value after the prefix list is created. For example, the CIDR blocks 10.0.0.0/8 and 172.16.0.0/12 count as two entries.
Valid values: 1 to 200
NoteAssociated resources, such as security groups, use the value of max entries to calculate their rule quotas, regardless of the actual number of entries.
Prefix list entries
Specify the CIDR blocks. You can click Add Entry to add a CIDR block and a description.
The following limits apply to entries in a prefix list:
The total number of entries cannot exceed the value of Max Entries.
You can enter multiple CIDR blocks, separated by a space or a comma (,).
The Address Family setting determines the type of CIDR blocks that you can add. A prefix list cannot contain both IPv4 and IPv6 CIDR blocks.
Each CIDR block entry must be unique. For example, you cannot add 192.168.1.0/24 twice.
You can specify an IP address. The system automatically converts it into a CIDR block.
For example, if you specify 192.168.1.100, the system automatically converts it to 192.168.1.100/32.
If you specify an IPv6 CIDR block, the system automatically converts it to its compressed format.
For example, if you specify 2001:0DB8:0000:0000:0000:0000:0000:0000/32, the system automatically converts it to 2001:db8::/32.
Click OK.
After the prefix list is created, you can view its information on the list page. You can also reference the prefix list in security group rules. For more information, see Add a security group rule.
API
Call the CreatePrefixList operation to create a prefix list. After the prefix list is created, you can call the DescribePrefixListAttributes operation to query the details of the prefix list.
You can call the AuthorizeSecurityGroup operation and set the SourcePrefixListId parameter in an inbound rule of a security group to reference the prefix list that you created.
You can also call the AuthorizeSecurityGroupEgress operation and set the DestPrefixListId parameter in an outbound rule of a security group to reference the prefix list that you created.
Clone a prefix list
To accommodate business changes like a cross-region migration, you can quickly clone a prefix list to a new region.
Go to ECS Console - Prefix List.
In the upper-left corner of the page, select a region and resource group.
On the Prefix Lists tab, find the prefix list that you want to clone, and in the Operation column, click Clone.
In the Clone dialog box, configure the parameters for the prefix list.
Parameter
Description
Region
Select the region where you want to create the cloned prefix list. For example, China (Qingdao).
Prefix list name
Enter a name for the cloned prefix list.
Description
Enter a description for the cloned prefix list. We recommend that you describe its intended purpose.
Address family
Select the IPv4 or IPv6 Supported address family. You cannot change the address family after the prefix list is created.
If you select IPv4, you can add only IPv4 CIDR blocks.
If you select IPv6 Supported, you can add only IPv6 CIDR blocks.
Max entries
Specify the maximum number of entries that the prefix list can contain. You cannot change this value after the prefix list is created.
Valid values: 1 to 200
NoteAssociated resources, such as security groups, use the value of max entries to calculate their rule quotas, regardless of the actual number of entries.
Prefix list entries
Specify the CIDR blocks. You can click Add Entry to add a CIDR block and a description.
Copy Tags to Clone Prefix List: Select this option to copy the tags from the source prefix list to the new, cloned prefix list.
Click OK.
After the operation is complete, you can switch to the destination region to view the cloned prefix list.
Manage prefix list entries
You can add, modify, or delete entries in a prefix list to reflect network changes, such as adding servers or updating IP addresses. These changes automatically apply to all associated security group rules, allowing for rapid policy updates.
ECS console
Go to ECS Console - Prefix List.
In the upper-left corner of the page, select a region and resource group.
On the Prefix Lists tab, find the prefix list that you want to manage and click its ID.
On the Entries tab, manage the entries in the prefix list.
Add an entry
Click Add Entry.
Enter a CIDR block and a description, and then click Save.
To add more entries, repeat these steps.
Modify an entry
On the prefix list details page, find the entry to modify and click Modify in the Actions column.
Modify the CIDR block and description of the entry, and then click Save.
Delete entries
To delete a single entry, find the entry and click Delete in the Actions column.
To delete multiple entries, select them and click Delete at the bottom of the list.
API
Call the ModifyPrefixList operation to manage the entries in a prefix list and modify its name and description.
Associated resources
You can view the resources that are associated with a prefix list. Currently, prefix lists can be used only in security group rules.
ECS console
Go to ECS Console - Prefix List.
In the upper-left corner of the page, select a region and resource group.
On the Prefix Lists tab, find the prefix list that you want to manage and click its ID.
Click the Associated Resources tab to view the IDs and types of the resources that are associated with the prefix list.
API
Call the DescribePrefixListAssociations operation to query the resources that are associated with a prefix list.
Delete a prefix list
You can delete a prefix list only if it is not associated with any resources.
You must first disassociate it from all associated resources.
ECS console
Go to ECS Console - Prefix List.
In the upper-left corner of the page, select a region and resource group.
On the Prefix Lists tab, find and delete the required prefix list or lists.
Delete a single prefix list
Find the prefix list that you want to delete and click Delete in the Actions column. In the dialog box that appears, confirm the information and click OK.
Delete multiple prefix lists
Select the prefix lists that you want to delete and click Batch Delete at the bottom of the page. In the dialog box that appears, confirm the information, click Next, and then click OK.
API
Call the DeletePrefixList operation to delete a prefix list and all of its entries.
Related documents
For more information about the use cases of prefix lists, see Efficiently manage security group rules by using prefix lists and port lists.