Assigns one or more IPv6 addresses to an elastic network interface (ENI).

Usage notes

You can specify IPv6 addresses within the CIDR block of the vSwitch that is connected to the ENI, or specify the number of IPv6 addresses that are automatically generated for the ENI. Take note of the following items:

  • IPv6 must be enabled for the vSwitch to which the ENI is connected. For more information, see Enable IPv6 for a vSwitch.
  • The ENI must be in the Available (Available) or InUse (InUse) state.
  • If you want to assign IPv6 addresses to a primary ENI, make sure that the Elastic Compute Service (ECS) instance to which the ENI is attached is in the Running (Running) or Stopped (Stopped) state.
  • The maximum number of IPv6 addresses that can be assigned to an ENI varies based on the instance type.
    • If the ENI is in the Available (Available) state, it can be assigned a maximum of 10 IPv6 addresses.
    • If the ENI is already attached to an ECS instance, the maximum number of IPv6 addresses that can be assigned to the ENI varies based on the instance type. For more information, see Instance families.
  • After the operation is called, you can obtain the IPv6 addresses assigned to the ENI from the response.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

ParameterTypeRequiredExampleDescription
ActionStringYesAssignIpv6Addresses

The operation that you want to perform. Set the value to AssignIpv6Addresses.

RegionIdStringYescn-hangzhou

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

NetworkInterfaceIdStringYeseni-bp1iqejowblx6h8j****

The ENI ID.

Ipv6AddressCountIntegerNo1

The number of IPv6 addresses to generate at random for the ENI. Valid values: 1 to 10.

Note You must specify Ipv6Addresses.N or Ipv6AddressCount but not both.
Ipv6Address.NStringNo2001:db8:1234:1a00::****

IPv6 address N to assign to the ENI. Valid values of N: 1 to 10.

Example: Ipv6Address.1=2001:db8:1234:1a00::****

Note You must specify Ipv6Addresses.N or Ipv6AddressCount but not both.
Ipv6Prefix.NStringNo2001:db8:1234:1a00:****::/80

IPv6 prefix N to assign to the ENI. Valid values of N: 1 to 10.

Note To assign IPv6 prefixes to the ENI, you must specify Ipv6Prefix.N or Ipv6PrefixCount but not both.
Ipv6PrefixCountIntegerNo1

The number of IPv6 prefixes to assign to the ENI. Valid values: 1 to 10.

Note To assign IPv6 prefixes to the ENI, you must specify Ipv6Prefix.N or Ipv6PrefixCount but not both.
ClientTokenStringNo123e4567-e89b-12d3-a456-426655440000

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.

Response parameters

ParameterTypeExampleDescription
RequestIdString473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The request ID.

NetworkInterfaceIdStringeni-bp1iqejowblx6h8j****

The ENI ID.

Ipv6SetsArray of String2001:db8:1234:1a00::****

The IPv6 addresses assigned to the ENI.

Ipv6PrefixSetsArray of String2001:db8:1234:1a00:****::/80

The IPv6 prefixes assigned to the ENI.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=AssignIpv6Addresses
&NetworkInterfaceId=eni-bp1iqejowblx6h8j****
&RegionId=cn-hangzhou
&Ipv6Address.1=2001:db8:1234:1a00::****
&Ipv6Address.2=2001:db8:1234:1a01::****
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<AssignIpv6AddressesResponse>
    <Ipv6Sets>
        <Ipv6Address>2001:db8:1234:1a00::****</Ipv6Address>
        <Ipv6Address>2001:db8:1234:1a01::****</Ipv6Address>
    </Ipv6Sets>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
    <NetworkInterfaceId>eni-bp1iqejowblx6h8j****</NetworkInterfaceId>
</AssignIpv6AddressesResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "Ipv6Sets" : {
    "Ipv6Address" : [ "2001:db8:1234:1a00::****", "2001:db8:1234:1a01::****" ]
  },
  "RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
  "NetworkInterfaceId" : "eni-bp1iqejowblx6h8j****"
}

Error codes

HTTP status codeError codeError messageDescription
400UnsupportedParameter%sA specified parameter is not supported.
400InvalidParameter%sInvalid parameter value.
400InvalidInstanceID.Malformed%sInvalid InstanceId format.
400MissingParameter%sA required parameter is not specified.
400InvalidParams.EniId%sInvalid NetworkInterfaceId value.
400InvalidOperation.InvalidEcsState%sThis operation cannot be performed on the instance in the current state.
400InvalidOperation.InvalidEniState%sThis operation cannot be performed on the ENI in the current state.
400InvalidPrivateIpAddress.DuplicatedSpecified private IP address is duplicated.The specified private IP address is already in use. Try a different IP address.
400IncorrectVSwitchStatusThe current status of vSwitch does not support this operation.This operation cannot be performed on the vSwitch in the current state.
400InvalidParameter.Conflict%sInvalid parameter value. Check whether parameter conflicts exist. %s is a variable. An error message is dynamically returned based on call conditions.
403InvalidUserType.NotSupported%sYour account does not support this operation.
403Abs.InvalidAccount.NotFound%sYour Alibaba Cloud account is not found, or your AccessKey pair expired.
403Forbedden.NotSupportRAM%sResource Access Management (RAM) users do not have the required permissions to perform this operation.
403Forbbiden.SubUser%sYou are not authorized to manage this resource. Contact the owner of the Alibaba Cloud account for authorization.
403InvalidOperation.InvalidEniType%sThe operation is not supported while the ENI is of the current type.
403MaxEniIpv6IpsCountExceeded%sThe maximum number of IPv6 addresses that can be assigned to the ENI is exceeded.
403InvalidIp.IpUnassigned%sThe specified IP address is not assigned.
403InvalidIp.IpRepeated%sThe specified IP address already exists.
403InvalidIp.IpAssigned%sThe specified IP address is already assigned.
403InvalidOperation.Ipv4CountExceeded%sThe maximum number of IPv4 addresses is exceeded.
403InvalidOperation.Ipv6CountExceeded%sThe maximum number of IPv6 addresses is exceeded.
403InvalidOperation.Ipv6NotSupport%sIPv6 addresses do not support the operation.
403InvalidVSwitch.Ipv6NotTurnOn%sThe IPv6 feature is not enabled for your current vSwitch. Enable the feature and try again.
403InvalidVSwitchId.IpInvalid%sThe specified private IP address is invalid.
403Forbidden.RegionId%sThe service is unavailable in the current region.
403InvalidOperation.EniServiceManaged%sThe operation is invalid.
403SecurityGroupInstanceLimitExceed%sThe maximum number of instances in the specified security group is exceeded.
403InvalidIp.IpPrefixIllegalThe ip prefixes %s is/are illegal.The IP prefix is invalid and is not in the CIDR format.
403InvalidIp.IpPrefixMaskIllegalThe ip prefix mask is illegal.The IP prefix mask is invalid.
403InvalidIp.IpPrefixMaskInvalidThe ip prefixes mask %s is illegal which must be between %s and %s.The IP prefix mask is invalid and is not within the valid range.
403InvalidIp.IpPrefixMaskNotSameThe ip prefixes %s are illegal which mask must be same.The IP prefix masks are not the same.
403InvalidIp.IpPrefixMustInReserveSegmentThe ip prefix must in vswitch reserve segment.The IP prefix is invalid and is not in the reserved CIDR block of the vSwitch.
403InvalidIp.IpPrefixNotAvailableThe ip prefix is/are not available.The IP prefix is not available.
403InvalidIp.IpPrefixNotStrictThe ip prefix must be strict cidr format.The IP prefix is invalid and is not in the CIDR format.
403InvalidVSwitchId.IpPrefixNotEnoughThe specified vSwitch has not enough ip prefix.The number of IP prefixes in the specified vSwitch is insufficient.
403MissingParameterThese parameters %s cannot be both empty.A required parameter is not specified. The required parameters cannot be empty.
404InvalidEniId.NotFound%sThe specified ENI ID is not found.
500InvalidOperation.RegionNotSupportIpPrefixThe current region does not support ip prefix.You cannot assign IP prefixes in this region.

For a list of error codes, see Service error codes.