Assigns one or more secondary private IP addresses to an elastic network interface (ENI). You can specify available private IP addresses within the CIDR block of the vSwitch that hosts the ENI. Alternatively, you can specify the number of private IP addresses for Elastic Compute Service (ECS) to automatically assign them.
Operation description
Usage notes
- The ENI to which you want to assign secondary private IP addresses must be in the Available (Available) or InUse (InUse) state.
- When you assign secondary private IP addresses to a primary ENI, the instance to which the ENI is attached must be in the Running (Running) or Stopped (Stopped) state.
- When an ENI is in the Available state, you can assign up to 50 secondary private IP addresses to it. When an ENI is attached to an instance, the number of secondary private IP addresses that can be assigned to the ENI is subject to the instance type. For more information, see Overview of instance families.
- After you call this operation for an ENI, you can obtain the secondary private IP addresses that are assigned to the ENI from the response.
Debugging
Authorization information
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RegionId | string | Yes | The region ID of the ENI. You can call the DescribeRegions operation to query the most recent region list. | cn-hangzhou |
NetworkInterfaceId | string | Yes | The ID of the ENI. | eni-bp67acfmxazb4p**** |
SecondaryPrivateIpAddressCount | integer | No | The number of private IP addresses to be automatically assigned from the CIDR block of the vSwitch that is connected to the ENI. To assign secondary private IP addresses to the ENI, you must specify | 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 you must make sure that the token is unique among different requests. The token 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 | Secondary private IP address N to be automatically assigned from the CIDR block of the vSwitch that is connected to the ENI. Valid values of N:
To assign secondary private IP addresses to the ENI, you must specify | |
string | No | Secondary private IP address N to be automatically assigned from the CIDR block of the vSwitch that is connected to the ENI. Valid values of N:
Note
To assign secondary private IP addresses to the ENI, you specify PrivateIpAddress.N and SecondaryPrivateIpAddressCount but not both.
| 10.1.**.** |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
"AssignedPrivateIpAddressesSet": {
"NetworkInterfaceId": "eni-bp125p95hhdhn3ot****",
"PrivateIpSet": {
"PrivateIpAddress": [
"192.168.**.**"
]
},
"Ipv4PrefixSet": {
"Ipv4Prefixes": [
"hide"
]
}
}
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | Throttling | Request was denied due to request throttling. | - |
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 | - |
400 | InvalidOperation.InvalidEniState | %s | - |
400 | InvalidOperation.DetachPrimaryEniNotAllowed | %s | - |
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 | InvalidEniId.Malformed | The specified parameter "EniId" is not valid. | - |
400 | IncorrectVSwitchStatus | The current status of vSwitch does not support this operation. | - |
400 | InvalidPrivateIpAddress.Duplicated | Specified private IP address is duplicated. | - |
400 | InvalidPrivateIpAddress.Malformed | %s | - |
400 | InvalidSecondaryPrivateIpAddressCount.Malformed | %s | - |
400 | QuotaExceeded.PrivateIpAddress | There is no enough private ip in the specified VSwitch. | - |
400 | InvalidOperation.InvalidEniState | The operation is not allowed in the current ENI state. | - |
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. |
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 | 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 | - |
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 | - |
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 ip prefix mask is illegal. | The IP address prefix mask is invalid. |
403 | InvalidIp.IpPrefixMaskInvalid | The ip prefixes mask %s is illegal which must be between %s and %s. | The IP address prefix mask is invalid and is not within the valid range. |
403 | InvalidIp.IpPrefixMaskNotSame | The ip prefixes %s are illegal which mask must be same. | The IP address prefix masks are not the same. |
403 | InvalidIp.IpPrefixMustInReserveSegment | The ip prefix must in vswitch reserve segment. | The IP address prefix is invalid and is not in the reserved CIDR block of the vSwitch. |
403 | InvalidIp.IpPrefixNotAvailable | The ip prefix is/are not available. | The IP address prefix is not available. |
403 | InvalidIp.IpPrefixNotStrict | The ip prefix must be strict cidr format. | The IP address prefix is invalid and is not in the CIDR format. |
403 | InvalidVSwitchId.IpPrefixNotEnough | The specified vSwitch has not enough ip prefix. | The number of IP address prefixes in the specified vSwitch is insufficient. |
403 | MissingParameter | These parameters %s cannot be both empty. | A required parameter is not specified. The required parameters cannot be empty. |
404 | InvalidEcsId.NotFound | %s | The specified instance ID does not exist. |
404 | InvalidEniId.NotFound | %s | The specified ENI ID does not exist. |
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 | The specified instance does not exist. Check whether the InstanceId parameter is valid. |
404 | InvalidOperation.VSwitchCidrReservationNotExist | The specified vSwitch has no cidr reservation. | - |
500 | InvalidOperation.RegionNotSupportIpPrefix | The current region does not support ip prefix. | You cannot assign IP address prefixes in this region. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
2023-08-17 | The Error code has changed | see changesets | ||||||||||
| ||||||||||||
2023-04-26 | The Error code has changed | see changesets | ||||||||||
|