Creates a prefix list.
Description
- A prefix list is a set of one or more network prefixes (CIDR blocks). You can reference prefix lists to configure network rules for other network resources. For more information, see Overview.
- When you create a prefix list, take note of the following items:
- You must specify an IP address family (IPv4 or IPv6) for the prefix list, and cannot change the IP address family after the prefix list is created. You cannot combine IPv4 and IPv6 CIDR blocks in a single prefix list.
- You must specify the maximum number of entries that the prefix list can contain. You cannot modify the maximum number of entries after the prefix list is created.
- You can specify one or more entries for the prefix list. Each entry consists of a CIDR block and a description for the CIDR block. The total number of your specified entries cannot exceed the maximum number.
- For more information about the limits on prefix lists and other resources, see Limits.
- You can create RAM users and grant them minimum permissions. This eliminates the need to share the AccessKey pair of your Alibaba Cloud account with other users and reduces security risks for your enterprises. For information about how to grant permissions on prefix lists to RAM users, see Grant permissions on prefix lists to RAM users
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | CreatePrefixList |
The operation that you want to perform. Set the value to CreatePrefixList. |
RegionId | String | Yes | cn-chengdu |
The ID of the region in which to create the prefix list. |
MaxEntries | Integer | Yes | 10 |
The maximum number of entries that the prefix list can contain. Valid values: 1 to 200. |
AddressFamily | String | Yes | IPv4 |
The IP address family. Valid values:
|
ClientToken | String | No | 0c593ea1-3bea-11e9-b96b-88e9fe637760 |
The client token that is used to ensure the idempotence of the request. You can use
the client to generate the value, but you must make sure that it is unique among different
requests. The |
PrefixListName | String | Yes | PrefixListNameSample |
The name of the prefix list. The name must be 2 to 128 characters in length. It must
start with a letter and cannot start with |
Description | String | No | This is description. |
The description of the prefix list. The description must be 2 to 256 characters in
length and cannot start with |
Entry.N.Description | String | No | Description Sample 01 |
The description in entry N. The description must be 2 to 32 characters in length and
cannot start with |
Entry.N.Cidr | String | Yes | 192.168.1.0/24 |
The CIDR block in entry N. Valid values of N: 0 to 200. Take note of the following items:
For more information about CIDR blocks, see the "What is CIDR block?" section of the Network FAQ topic. This parameter is empty by default. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
PrefixListId | String | pl-x1j1k5ykzqlixdcy**** |
The ID of the prefix list. |
RequestId | String | 38793DB8-A4B2-4AEC-BFD3-111234E9188D |
The ID of the request. |
Examples
Sample requests
https://ecs.aliyuncs.com/?Action=CreatePrefixList
&RegionId=cn-chengdu
&AddressFamily=IPv4
&MaxEntries=20
&Entry.1.Cidr=192.168.1.0/24
&Entry.1.Description=Description Sample 01
&PrefixListName=PrefixListNameSample
&Description=This is description.
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<CreatePrefixListResponse>
<RequestId>38793DB8-A4B2-4AEC-BFD3-111234E9188D</RequestId>
<PrefixListId>pl-x1j1k5ykzqlixdcy****</PrefixListId>
</CreatePrefixListResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "38793DB8-A4B2-4AEC-BFD3-111234E9188D",
"PrefixListId" : "pl-x1j1k5ykzqlixdcy****"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | MissingParameter | %s | The error message returned because a required parameter is not specified. |
400 | InvalidParameter.AddressFamily | The parameter AddressFamily should be IPv4 or IPv6. | The error message returned because the specified AddressFamily parameter is invalid. The valid values of this parameter are IPv4 and IPv6. |
400 | InvalidParameter | %s | The error message returned because a specified parameter is invalid. |
400 | InvalidParameter.PrefixListName | The parameter PrefixListName is not valid. | The error message returned because the specified PrefixListName parameter is invalid. |
400 | InvalidClientToken.ValueNotSupported | The ClientToken provided is invalid. | The error message returned because the specified ClientToken parameter is invalid. |
400 | InvalidParameter.CidrMalformed | %s | The error message returned because the specified Entry.N.Cidr parameter is invalid. |
400 | InvalidParameter.CidrDuplicated | %s | The error message returned because duplicate CIDR blocks are specified in one or more entries. |
400 | LimitExceed.Entry | The number of entries added or removed exceeds the limit. | The error message returned because the number of entries to add or remove at a time exceeds the limit. |
400 | LimitExceed.MaxEntries | The number of entries exceeds the MaxEntries of the specified prefix list. | The error message returned because the number of specified entries exceeds the MaxEntries value. |
404 | LimitExceed.PrefixListPerRegion | The number of prefix lists in the region exceeds the limit. | The error message returned because the maximum number of prefix lists in the current region has been reached. |
For a list of error codes, visit the API Error Center.