All Products
Search
Document Center

Elastic Compute Service:AssignIpv6Addresses

Last Updated:Dec 25, 2024

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

Operation description

Usage notes

You can specify IPv6 addresses in the CIDR block of the vSwitch to which the ENI is connected. You can also specify the number of IPv6 addresses that the system assigns to the ENI. Take note of the following items:

  • IPv6 must be enabled on 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 of the instance to which the ENI is attached.

    • If the ENI is in the Available (Available) state, up to 10 IPv6 addresses can be assigned to the ENI.
    • If the ENI is 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 Overview of instance families.
  • After the operation is called, you can obtain the IPv6 addresses that are assigned to the ENI from the response.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ecs:AssignIpv6Addressescreate
*NetworkInterface
acs:ecs:{#regionId}:{#accountId}:eni/{#eniId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

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

cn-hangzhou
NetworkInterfaceIdstringYes

The ENI ID.

eni-bp1iqejowblx6h8j****
Ipv6AddressCountintegerNo

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.
1
Ipv6AddressarrayNo

The IPv6 addresses 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.
stringNo

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.
2001:db8:1234:1a00::****
Ipv6PrefixarrayNo

The IPv6 prefixes 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.
stringNo

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.
hide
Ipv6PrefixCountintegerNo

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.
hide
ClientTokenstringNo

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

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The request ID.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E
NetworkInterfaceIdstring

The ENI ID.

eni-bp1iqejowblx6h8j****
Ipv6Setsarray

The IPv6 addresses assigned to the ENI.

Ipv6Addressstring

The IPv6 addresses assigned to the ENI.

2001:db8:1234:1a00::****
Ipv6PrefixSetsarray

The IPv6 prefixes of the ENI.

Ipv6Prefixstring

The IPv6 prefix of the ENI.

hide

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError messageDescription
400UnsupportedParameter%sThe parameter is not supported.
400InvalidParameter%sThe specified parameter is invalid.
400InvalidInstanceID.Malformed%sThe specified InstanceId parameter is invalid.
400MissingParameter%sA parameter is not specified.
400InValidParameter%sThe specified parameter is invalid.
400InvalidParams.EniId%sThe specified EniId parameter is invalid.
400InvalidOperation.InvalidEcsState%s-
400InvalidOperation.InvalidEniState%s-
400InvalidPrivateIpAddress.DuplicatedSpecified private IP address is duplicated.-
400IncorrectVSwitchStatusThe current status of vSwitch does not support this operation.-
400InvalidParameter.Conflict%sThe specified parameter is invalid. 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 does not exist or your AccessKey pair has expired.
403Forbedden.NotSupportRAM%sRAM users are not authorized 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%s-
403MaxEniIpv6IpsCountExceeded%sThe maximum number of IPv6 addresses that can be assigned to the ENI has been reached.
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.
403InvalidIp.Address%s-
403InvalidOperation.EniCountExceeded%s-
403InvalidOperation.Ipv4CountExceeded%sThe operation is valid because the maximum number of IPv4 addresses has been reached.
403InvalidOperation.Ipv6CountExceeded%sThe operation is valid because the maximum number of IPv6 addresses has been reached.
403InvalidOperation.Ipv6NotSupport%s-
403InvalidOperation.Ipv4NotSupport%s-
403InvalidVSwitch.Ipv6NotTurnOn%sThe IPv6 feature is not enabled for your current vSwitch. Enable the feature and try again.
403InvalidParam.IpAssign%s-
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%s-
403InvalidOperation.HighPerformanceTrafficModeEniNotSupport%s-
403InvalidOperation.EniTypeNotSupportThe member eni does not support ipv6.-
403InvalidIp.IpPrefixIllegalThe ip prefixes %s is/are illegal.The IP address prefix is invalid and is not in the CIDR format.
403InvalidIp.IpPrefixMaskIllegalThe ip prefix mask is illegal.The IP address prefix mask is invalid.
403InvalidIp.IpPrefixMaskInvalidThe 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.
403InvalidIp.IpPrefixMaskNotSameThe ip prefixes %s are illegal which mask must be same.The IP address prefix masks are not the same.
403InvalidIp.IpPrefixMustInReserveSegmentThe ip prefix must in vswitch reserve segment.The IP address prefix is invalid and is not in the reserved CIDR block of the vSwitch.
403InvalidIp.IpPrefixNotAvailableThe ip prefix is/are not available.The IP address prefix is not available.
403InvalidIp.IpPrefixNotStrictThe ip prefix must be strict cidr format.The IP address prefix is invalid and is not in the CIDR format.
403InvalidVSwitchId.IpPrefixNotEnoughThe specified vSwitch has not enough ip prefix.The number of IP address prefixes in the specified vSwitch is insufficient.
403MissingParameterThese parameters %s cannot be both empty.-
404InvalidEniId.NotFound%sThe specified ENI ID does not exist.
404MaxEniIpv6IpsCountExceededThe ipv6 address count exceed limitation.-
404InvalidOperation.VSwitchIpv6DisabledThe specified VSwitch does not support Ipv6 feature.The specified VSwitch does not support IPv6.
404InvalidOperation.EnableIpv6FailedThe specified VSwitch does not support Ipv6 feature.-
404InvalidIp.IpAssignedThe specified ipv6 has already been allocated.-
404InvalidVSwitchId.IpInvalidThe specified ipv6 does not match VSwitch cidr scope.-
404InvalidOperation.HasIpv6RouteEntryThe specified eni has been pointed to the next hop of the route.-
404InvalidOperation.VSwitchCidrReservationNotExistThe specified vSwitch has no cidr reservation.-
500InvalidOperation.RegionNotSupportIpPrefixThe 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 timeSummary of changesOperation
2024-12-17API Description Update. The Error code has changedView Change Details
2023-04-26The Error code has changedView Change Details
2021-07-05The Error code has changed. The response structure of the API has changedView Change Details