Assigns one or more secondary private IP addresses to an elastic network interfaces (ENIs). You can specify idle private IP addresses from the vSwitch to which the elastic network interfaces (ENIs) belongs, or specify the number of private IP addresses to automatically allocate.
Operation description
Operation description
Only elastic network interfaces (ENIs) in the Available or InUse state are supported.
When you operate the primary network interface controller (NIC), the instance to which the network interface controller (NIC) is attached must be in the Running or Stopped state.
When an elastic network interfaces (ENIs) is in the Available state, you can allocate up to 49 secondary private IP addresses to the ENI. After the ENI is attached to an instance, the number of secondary private IP addresses that can be allocated to the ENI is subject to the instance type. For more information, see Instance families.
After you call this operation, you can obtain the allocated secondary private IP address information from the response.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ecs:AssignPrivateIpAddresses |
create |
*NetworkInterface
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
The region ID of the elastic network interfaces (ENIs). You can call DescribeRegions to query the most recent region list. |
cn-hangzhou |
| NetworkInterfaceId |
string |
Yes |
The elastic network interfaces (ENIs) ID. |
eni-bp67acfmxazb4p**** |
| SecondaryPrivateIpAddressCount |
integer |
No |
The number of private IP addresses to automatically assign from the idle IP addresses of the vSwitch. When you assign secondary private IP addresses, you cannot specify both |
1 |
| ClientToken |
string |
No |
The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but make sure that the token is unique among different requests. The ClientToken value can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence. |
123e4567-e89b-12d3-a456-426655440000 |
| PrivateIpAddress |
array |
No |
One or more secondary private IP addresses selected from the idle private IP addresses of the vSwitch to which the elastic network interfaces (ENIs) belongs. Valid values of N:
When you allocate secondary private IP addresses, you cannot specify both |
10.1.**.** |
|
string |
No |
One or more secondary private IP addresses selected from the idle private IP addresses of the vSwitch to which the elastic network interfaces (ENIs) belongs. Valid values of N:
Note
When you allocate secondary private IP addresses, you cannot specify both |
10.1.**.** |
|
| Ipv4Prefix |
array |
No |
One or more IPv4 prefixes to specify for the elastic network interfaces (ENIs). Valid values of N: 1 to 10. Note
To set IPv4 prefixes for the elastic network interfaces (ENIs), you must set either the Ipv4Prefix.N parameter or the Ipv4PrefixCount parameter, but not both. |
|
|
string |
No |
One or more IPv4 prefixes to specify for the elastic network interfaces (ENIs). Valid values of N: 1 to 10. Note
To set IPv4 prefixes for the elastic network interfaces (ENIs), you must set either the Ipv4Prefix.N parameter or the Ipv4PrefixCount parameter, but not both. |
192.168.**.**/28 |
|
| Ipv4PrefixCount |
integer |
No |
The number of randomly generated IPv4 prefixes to specify for the elastic network interfaces (ENIs). Valid values: 1 to 10. Note
To set IPv4 prefixes for the elastic network interfaces (ENIs), you must set either the Ipv4Prefix.N parameter or the Ipv4PrefixCount parameter, but not both. |
1 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
| AssignedPrivateIpAddressesSet |
object |
The information about the elastic network interfaces (ENIs) to which secondary private IP addresses are assigned. |
|
| NetworkInterfaceId |
string |
The elastic network interfaces (ENIs) ID. |
eni-bp125p95hhdhn3ot**** |
| PrivateIpSet |
object |
||
| PrivateIpAddress |
array |
The set of assigned private IP addresses. |
|
|
string |
The assigned private IP address. |
192.168.**.** |
|
| Ipv4PrefixSet |
object |
||
| Ipv4Prefixes |
array |
The set of assigned IPv4 prefixes. |
|
|
string |
The assigned IPv4 prefix. |
192.168.**.**/28 |
Examples
Success response
JSON format
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
"AssignedPrivateIpAddressesSet": {
"NetworkInterfaceId": "eni-bp125p95hhdhn3ot****",
"PrivateIpSet": {
"PrivateIpAddress": [
"192.168.**.**"
]
},
"Ipv4PrefixSet": {
"Ipv4Prefixes": [
"192.168.**.**/28"
]
}
}
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | Throttling | Request was denied due to request throttling. | The request is throttled. |
| 400 | InvalidOperation.Unsupported | %s | |
| 400 | UnsupportedParameter | %s | The parameter is not supported. |
| 400 | InvalidParameter | %s | The specified parameter is invalid. |
| 400 | InvalidInstanceID.Malformed | %s | The specified InstanceId parameter is invalid. |
| 400 | InvalidOperation.InvalidEcsState | %s | This operation is not allowed in the current cloud service status. |
| 400 | InvalidOperation.InvalidEniState | %s | The current state of the network interface controller (NIC) does not allow this operation. |
| 400 | InvalidOperation.DetachPrimaryEniNotAllowed | %s | You cannot detach the primary ENI from an instance. |
| 400 | MissingParameter | %s | A parameter is not specified. |
| 400 | Forbidden.RegionId | %s | The service is unavailable in the current region. |
| 400 | InvalidAction | %s | The operation is invalid. |
| 400 | InvalidPrivateIpAddress.Duplicated | Specified private IP address is duplicated. | |
| 400 | InvalidPrivateIpAddress.Malformed | %s | |
| 400 | InvalidSecondaryPrivateIpAddressCount.Malformed | %s | |
| 400 | InvalidParameter.Conflict | %s | The specified parameter is invalid. Check whether parameter conflicts exist. %s is a variable. An error message is dynamically returned based on call conditions. |
| 400 | InvalidOperation.InstanceNotSupportMulitipleIp | Assigning private ip for instance in cloud box is unsupported. | The CloudBox environment does not support assigning multiple IP addresses to an instance. |
| 400 | IncorrectVSwitchStatus | The operation is not allowed in the current VSwitch state. Expecting state includes "Created Available", but current state is "%s". | The operation is not supported in the current state of the vSwitch. |
| 400 | QuotaExceeded.PrivateIpAddress | There are not enough private IPs in the specified VSwitch. | The current VSwitch does not have enough Ip |
| 400 | InvalidStatus.InstanceIsMigrating | The ECS which ENI is attached to is migrating. Please try again later. | The instance to which the ENI is attached is being migrated. Try again later. |
| 400 | InvalidEniId.Malformed | The specified parameter "NetworkInterfaceId" is not valid. Ensure you provide the full ENI id in the form eni-xxx. | NIC Id input does not meet specification |
| 400 | InvalidVSwitch.IllegalStatus | The operation is not allowed in the current VSwitch state. Expecting state includes "Created", but current state is "%s". | The current VSwitch status does not support this operation. |
| 400 | InvalidVSwitch.Ipv4NotEnabled | The specify VSwitch of ECS does not support IPv4. | |
| 400 | InvalidOperation.CidrAllocateNotEnough | There is no enough cidr to allocate. | not enough cidr available for allocation |
| 400 | TaskConflict | The operation is too frequent, please wait a moment and try again. | EIP operations are too frequent. |
| 400 | InvalidEniId.NotFound | The specified ENI ID does not exist. | The specified ENI ID does not exist. |
| 500 | InvalidOperation.RegionNotSupportIpPrefix | The current region does not support IP prefix feature. | The region does not support IP prefix allocation. |
| 500 | InternalError | The request processing has failed due to some unknown error, exception or failure. | An internal error has occurred. Try again later. |
| 500 | InvalidParameter.PrivateIpCount | The current privateIpCount is not in the range 1.0 through 100.0. | The current privateIpCount is not in the range of 1.0 to 100.0. |
| 403 | InvalidUserType.NotSupported | %s | Your account does not support this operation. |
| 403 | Abs.InvalidAccount.NotFound | %s | Your Alibaba Cloud account does not exist or your AccessKey pair has expired. |
| 403 | MissingParameter | %s | |
| 403 | Forbidden.NotSupportRAM | %s | RAM users are not authorized to perform this operation. |
| 403 | Forbidden.SubUser | %s | You are not authorized to manage this resource. Contact the owner of the Alibaba Cloud account for authorization. |
| 403 | MaxEniCountExceeded | %s | The maximum number of ENIs that can be managed has been reached. |
| 403 | EniPerInstanceLimitExceeded | %s | The maximum number of ENIs that can be attached to the specified instance has been reached. |
| 403 | InvalidOperation.AvailabilityZoneMismatch | %s | The operation is invalid. |
| 403 | InvalidOperation.VpcMismatch | %s | The operation is invalid. Check whether the VPC in the operation corresponds to other parameters. |
| 403 | SecurityGroupInstanceLimitExceed | %s | The maximum number of instances in the security group has been reached. |
| 403 | InvalidSecurityGroupId.NotVpc | %s | The specified SecurityGroupId parameter is invalid and the network type of the security group is not VPC. |
| 403 | InvalidOperation.InvalidEniType | %s | This operation is not allowed for the current NIC type. |
| 403 | InvalidVSwitchId.IpNotEnough | %s | The number of available IP addresses on the specified vSwitch is insufficient. |
| 403 | InvalidVSwitchId.IpInvalid | %s | The specified private IP address is invalid. |
| 403 | InvalidIp.IpAssigned | %s | The specified IP address is already assigned. |
| 403 | MaxEniPrivateIpsCountExceeded | %s | The maximum number of secondary private IP addresses that can be assigned to the specified ENI has been exceeded. For more information, see the return value of the %s placeholder in the error message. |
| 403 | Operation.Conflict | %s | This operation conflicts with another operation in progress. Try again later. |
| 403 | InvalidOperation.Ipv4CountExceeded | %s | The operation is valid because the maximum number of IPv4 addresses has been reached. |
| 403 | InvalidOperation.EniServiceManaged | %s | The operation is invalid. |
| 403 | InvalidIp.IpRepeated | %s | The specified IP address already exists. |
| 403 | InvalidIp.IpPrefixIllegal | The ip prefixes %s is/are illegal. | The IP address prefix is invalid and is not in the CIDR format. |
| 403 | InvalidIp.IpPrefixMaskIllegal | The current IP prefix mask is illegal. | Illegal IP prefix mask. |
| 403 | InvalidIp.IpPrefixMaskNotSame | The IP prefixes %s are illegal.The IP prefix mask must be the same. | The IP prefix masks are not the same. |
| 403 | InvalidIp.IpPrefixNotAvailable | The IP prefix is not available. | The IP prefix is not free. |
| 403 | InvalidIp.IpPrefixNotStrict | The IP prefix "%s" must be strict CIDR format. | Invalid IP prefix, not strictly cidr. |
| 403 | InvalidVSwitchId.IpPrefixNotEnough | The specified VSwitch does not have enough IP prefixes. | The number of IP prefixes in the specified switch is insufficient. |
| 403 | InvalidIp.IpPrefixMaskInvalid | The IP prefixes mask "%s" is illegal.Ensure the mask is between %s and %s. | The IP prefix mask is invalid and is not in the valid range. |
| 403 | InvalidIp.IpPrefixMustInReserveSegment | The IP prefix must be in VSwitch reserved segment. Ensure you create reserved segment for the VSwitch. | The IP prefix is invalid and is not in the reserved address segment of the switch. |
| 403 | InvalidOperation.TrunkingIsNotAllowed | The account is not authorized to use trunk ENI or perform trunking operation. | Operation of the trunk card is not allowed. You need to make sure that your account allows you to operate the trunk network card. If you have any questions, please submit the work order. |
| 403 | InvalidOperation.InvalidEcsState | The status of current instances does not support this operation. | The status of the current instances does not support this operation. |
| 404 | InvalidEcsId.NotFound | %s | The specified instance ID does not exist. |
| 404 | InvalidEniId.NotFound | %s | |
| 404 | InvalidVSwitchId.NotFound | %s | The specified vSwitch does not exist. |
| 404 | InvalidSecurityGroupId.NotFound | %s | The specified security group ID does not exist. |
| 404 | InvalidInstanceId.NotFound | %s | |
| 404 | InvalidOperation.VSwitchCidrReservationNotExist | The specified VSwitch does not have CIDR reservation. | The specified switch does not have a reserved segment available. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.