In some cases, you need to create a large number of elastic container instances to handle bursts of traffic or process jobs. However, if the resources in the zone that you specify are insufficient or the vSwitch that you specify does not have available IP addresses, no instances can be created. To address this issue, you can configure multiple zones to ensure sufficient available resources when you create elastic container instances. This topic describes how to configure multiple zones to create elastic container instances.
Prerequisites
vSwitches are created in different zones of the virtual private cloud (VPC) where you want to create an elastic container instance.
For information about how to create a vSwitch, see Create and manage a vSwitch.
For information about the regions and zones where Elastic Container Instance is available, see Regions and zones.
Background information
When you create an elastic container instance, you can specify multiple zones by specifying multiple vSwitches. Then, the system distributes the requests to all the specified zones at random. If requested resources are insufficient in a zone, the system tries to create the instance in a different zone.
When you specify multiple zones (vSwitches), take note of the following items:
The specified vSwitches must belong to the same VPC.
Up to 10 vSwitches can be specified.
You can specify multiple instance specifications and multiple zones at the same time to further improve the success rate of creating elastic container instances.
Configuration description
OpenAPI
If you create an elastic container instance by calling the CreateContainerGroup operation, you can use the VSwitchId parameter to specify multiple zones and use the ScheduleStrategy parameter to set the scheduling policy for multiple zones. The following table describes the parameters. For more information, see CreateContainerGroup.
Parameter | Type | Example | Description |
VSwitchId | String | vsw-bp1xpiowfm5vo8o3c****,vsw-bp1rkyjgr1xwoho6k**** | The IDs of vSwitches. You can specify up to 10 vSwitch IDs at a time. Separate multiple vSwitch IDs with commas (,). Example: vsw-***,vsw-***. |
ScheduleStrategy | String | VSwitchOrdered | The resource scheduling policy when you specify multiple zones to create an elastic container instance.
|
We recommend that you specify multiple zones and specifications to create elastic container instances. You can use the VSwitchId parameter to specify multiple zones and use the InstanceType parameter to specify multiple specifications.
Console mode
When you create an elastic container instance by using the buy page in the Elastic Container Instance console, you can select multiple vSwitches to specify multiple zones.
What to do next
If you use a network address translation (NAT) gateway to access the Internet and you configure multiple zones (vSwitches) to create elastic container instances, you must check whether the number of source network address translation (SNAT) entries that you configured for the NAT gateway is sufficient for the number of zones that you configured.
For example, when you create a SNAT entry, you specify a vSwitch for it. If you specify multiple vSwitches when you create an elastic container instance, you must increase SNAT entries for the new vSwitches to ensure that the elastic container instances that are connected to the new vSwitches can access the Internet.