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

Description

You can specify IPv6 addresses within the CIDR block of the vSwitch with which the ENI is associated, or specify the number of IPv6 addresses to automatically assign. Take note of the following items:

  • IPv6 must be enabled for the vSwitch with which the ENI is associated. For more information, see Enable IPv6 for a vSwitch.
  • The ENI must be in the Available (Available) or Bound (InUse) state.
  • The Elastic Compute Service (ECS) instance to which the primary ENI is bound must be in the Running (Running) or Stopped (Stopped) state.
  • The maximum number of IPv6 addresses that can be assigned to an ENI varies per 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 bound to an ECS instance, the maximum number of IPv6 addresses that can be assigned to the ENI is determined based on the instance type. For more information, see Instance families.

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

Parameter Type Required Example Description
Action String Yes AssignIpv6Addresses

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

RegionId String Yes cn-hangzhou

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

NetworkInterfaceId String Yes eni-bp1iqejowblx6h8j****

The ID of the ENI.

Ipv6Address.N RepeatList No 2001: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.
Ipv6AddressCount Integer No 1

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

Note You must specify Ipv6Addresses.N or Ipv6AddressCount but not both.

Response parameters

Parameter Type Example Description
Ipv6Sets List 2001:db8:1234:1a00::****

The IPv6 addresses assigned to the ENI.

NetworkInterfaceId String eni-bp1iqejowblx6h8j****

The ID of the ENI.

RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

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

<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

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

Error codes

HTTP status code Error code Error message Description
400 UnsupportedParameter %s The error message returned because a specified parameter is not supported.
400 InvalidParameter %s The error message returned because a specified parameter is invalid.
400 InvalidInstanceID.Malformed %s The error message returned because the specified InstanceId parameter is invalid.
400 MissingParameter %s The error message returned because a required parameter is not specified.
400 InvalidParams.EniId %s The error message returned because the specified NetworkInterfaceId parameter is invalid.
400 InvalidOperation.InvalidEcsState %s The error message returned because the operation is not supported while the instance is in the current state.
400 InvalidOperation.InvalidEniState %s The error message returned because the operation is not supported while the ENI is in the current state.
400 InvalidPrivateIpAddress.Duplicated Specified private IP address is duplicated. The error message returned because the specified private IP address is already in use. Try another IP address.
403 InvalidUserType.NotSupported %s The error message returned because your account does not support the operation.
403 Abs.InvalidAccount.NotFound %s The error message returned because your Alibaba Cloud account does not exist or because your AccessKey pair has expired.
403 Forbedden.NotSupportRAM %s The error message returned because RAM users are not authorized to perform this operation.
403 Forbbiden.SubUser %s The error message returned because you are not authorized to manage this resource. Contact the owner of the corresponding Alibaba Cloud account for authorization.
403 InvalidOperation.InvalidEniType %s The error message returned because the ENI type does not support this operation.
403 MaxEniIpv6IpsCountExceeded %s The error message returned because the maximum number of IPv6 addresses that can be assigned to the ENI has been reached.
403 InvalidIp.IpUnassigned %s The error message returned because the specified IP address is not assigned.
403 InvalidIp.IpRepeated %s The error message returned because the specified IP address already exists.
403 InvalidIp.IpAssigned %s The error message returned because the specified IP address is already assigned.
403 InvalidIp.Address %s The error message returned because the specified IPv6 address is invalid.
403 InvalidOperation.Ipv4CountExceeded %s The error message returned because the maximum number of IPv4 addresses has been reached.
403 InvalidOperation.Ipv6CountExceeded %s The error message returned because the maximum number of IPv6 addresses has been reached.
403 InvalidOperation.Ipv6NotSupport %s The error message returned because IPv6 addresses do not support the current operation.
403 InvalidVSwitch.Ipv6NotTurnOn %s The error message returned because the IPv6 feature is not enabled for your current vSwitch. Enable the feature and try again.
403 InvalidVSwitchId.IpInvalid %s The error message returned because the specified private IP address is invalid.
403 Forbidden.RegionId %s The error message returned because the service is currently unavailable in the current region.
403 InvalidOperation.EniServiceManaged %s The error message returned because the operation is invalid.
403 SecurityGroupInstanceLimitExceed %s The error message returned because the maximum number of instances that can be added to the security group has been reached.
404 InvalidEniId.NotFound %s The error message returned because the specified NetworkInterfaceId parameter does not exist.

For a list of error codes, visit the API Error Center.