All Products
Search
Document Center

Elastic Container Instance:Create instances across multiple availability zones

Last Updated:Jun 20, 2026

When you handle burst traffic, rapidly scale your services horizontally, or launch a large number of instances for batch jobs, you may encounter instance creation failures. These failures can be caused by insufficient inventory of a specific instance type in an availability zone or the exhaustion of IP addresses in a specified vSwitch. To improve the success rate of instance creation, you can specify multiple availability zones.

Prerequisites

You must have created multiple vSwitches in different availability zones within the target VPC.

Background information

When you create an ECI instance, you can specify multiple availability zones by providing multiple vSwitches. The system randomly distributes requests across the specified availability zones to balance the load. If an availability zone has insufficient inventory, the system automatically attempts to create the instance in another specified availability zone.

The following limitations apply when you specify multiple availability zones (vSwitches):

  • All specified vSwitches must belong to the same VPC.

  • You can specify a maximum of 10 vSwitches.

Combining multiple availability zones and multiple instance types further increases the instance creation success rate.

Configuration

API

When calling the CreateContainerGroup operation to create an ECI instance, use the VSwitchId parameter to specify multiple availability zones and the ScheduleStrategy parameter to configure the scheduling policy. These parameters are described in the following table. For more information, see CreateContainerGroup.

Parameter

Type

Example

Description

VSwitchId

String

vsw-bp1xpiowfm5vo8o3c,vsw-bp1rkyjgr1xwoho6k

The vSwitch ID. To specify multiple vSwitches, provide their IDs as a comma-separated string. You can specify up to 10 IDs. For example, vsw-...,vsw-....

ScheduleStrategy

String

VSwitchOrdered

The scheduling policy for the ECI instance when multiple availability zones are configured.

  • VSwitchOrdered: Schedules the instance based on the specified order. The rules are as follows:

    1. If the ECI pod mounts a disk, the availability zone of the disk must match the availability zone of the Pod. Availability zones that do not meet this requirement are filtered out.

    2. The system attempts to create the resource by trying the specified availability zones in order. If the first availability zone has insufficient inventory, it tries the second, and so on, until the resource is successfully created.

  • VSwitchRandom: Schedules the instance based on an inventory-optimized policy. The rules are as follows:

    1. If the ECI pod mounts a disk, the availability zone of the disk must match the availability zone of the Pod. Availability zones that do not meet this requirement are filtered out.

    2. Alibaba Cloud selects a suitable vSwitch (and its corresponding availability zone) based on an optimal inventory scheduling strategy.

    3. If the ECI pod specifies an instance type, the scheduler prioritizes availability zones that have a matching reserved instance for that type.

    4. Availability zones with better storage performance are prioritized. The following older availability zones have a lower scheduling priority:

      • cn-beijing-e, cn-beijing-d

      • cn-shenzhen-a, cn-shenzhen-b, cn-shenzhen-c

      • cn-hangzhou-b, cn-hangzhou-e, cn-hangzhou-f

      • cn-shanghai-a, cn-shanghai-c

Note

For the highest creation success rate, combine multiple availability zones (using the VSwitchId parameter) with multiple instance types (using the InstanceType parameter).

Console

When you create an ECI instance on the ECI buy page, you can select multiple vSwitches to specify multiple availability zones. On the ECI instance configuration page, set Region to China (Beijing) and select an existing VPC. If you need public network access, you must associate a NAT Gateway with the VPC and configure SNAT rules, or enable the feature to automatically create and associate an Elastic IP Address. In the vSwitch section, select multiple vSwitches from different availability zones, such as one from Zone E and one from Zone H in the China (Beijing) region. You can select up to 10 vSwitches to improve the creation success rate.

Next steps

If your instance uses a NAT Gateway to connect to the internet, you must update your SNAT entries after specifying multiple vSwitches.

For example, if your existing SNAT entries are configured at the vSwitch level, you must add new entries for the newly added vSwitches. This ensures that ECI instances launched in the new vSwitches can access the internet.