You can assign an IPv6 address to an elastic container instance by calling the CreateContainerGroup API operation to enable IPv6 connectivity.
Prerequisites
Before you begin, make sure that you have:
-
A VPC with IPv6 CIDR blocks enabled. For more information, see Enable IPv6 for a VPC
-
A vSwitch with IPv6 CIDR blocks enabled. For more information, see Enable IPv6 for a vSwitch
-
(Conditional) If you create elastic container instances by specifying Elastic Compute Service (ECS) instance types, the specified instance types must support IPv6 addresses. For more information, see Overview of instance families
All elastic container instances created by specifying the number of vCPUs and memory size support IPv6 addresses.
Limitations
Only one IPv6 address can be assigned to each elastic container instance.
Assign an IPv6 address through the API
Call the CreateContainerGroup API operation and set the following parameters:
| Parameter | Type | Example | Description |
|---|---|---|---|
| Ipv6AddressCount | Integer | 1 | The number of IPv6 addresses to assign. Set this to 1 because each elastic container instance supports only one IPv6 address. |
| Ipv6GatewayBandwidthEnable | Boolean | true | Enables or disables Internet access over IPv6 for the elastic container instance. |
| Ipv6GatewayBandwidth | Integer | 100 | The maximum Internet bandwidth of the IPv6 address, in Mbit/s. Takes effect only when Ipv6GatewayBandwidthEnable is set to true. For valid values, see the bandwidth range table below. Default value: the maximum value in the bandwidth range of the IPv6 gateway. |
Bandwidth ranges by billing method
The valid range for Ipv6GatewayBandwidth depends on the billing method of the IPv6 gateway Internet bandwidth:
| Billing method | Bandwidth range |
|---|---|
| pay-by-bandwidth | 1 to 2,000 Mbit/s |
| pay-by-traffic | 1 to 1,000 Mbit/s |
If you do not specify Ipv6GatewayBandwidth, the maximum value in the bandwidth range of the IPv6 gateway is used.
Verify the IPv6 address
After you create the elastic container instance, call the DescribeContainerGroups API operation to query the instance details. The assigned IPv6 address appears in the Ipv6Address field of the response.