All Products
Search
Document Center

Elastic Container Instance:Specify the number of vCPUs and memory size to create an elastic container instance

Last Updated:Jun 13, 2024

If you do not require special specifications such as GPUs and local disks, we recommend that you specify the number of vCPUs and memory size instead of Elastic Compute Service (ECS) instance types to create elastic container instances. Then, the system tries to match multiple ECS instance types with the specified vCPU and memory specifications. This method provides better elasticity and resource provisioning than the method of specifying a single ECS instance type.

Specification description

You can specify the number of vCPUs and memory size for the instance or containers in the instance when you create an elastic container instance. If the number of vCPUs or memory size that you specify is not supported by Elastic Container Instance, the system adjusts the number or size based on the specifications supported by Elastic Container Instance. When the system adjusts the number or size, the system selects the most similar specifications supported by Elastic Container Instance to create the instance, and the specifications selected by the system are higher than or equal to the specifications that you specified for the instance. For example, if you specify 7 vCPUs and 13 GiB of memory when you create an elastic container instance in the China (Hangzhou) region, the system creates an instance that contains 8 vCPUs and 14 GiB of memory.

The following tables describe the specifications supported by Elastic Container Instance.

Note
  • If you do not specify the number of vCPUs and memory size, the system uses 2 vCPUs and 4 GiB of memory to create an elastic container instance by default.

  • Each elastic container instance can have only one elastic network interface (ENI) bound.

  • The default temporary storage space for all specifications is 30 GiB in size.

Specifications supported in all regions where Elastic Container Instance is available

Number of vCPUs

Memory (GiB)

Bandwidth (bidirectional, Gbit/s, theoretical upper limit)

0.25

0.5 and 1

0.08

0.5

1 and 2

0.08

1

2, 4, and 8

0.1

2

1, 2, 4, 8, and 16

1

4

2, 4, 8, 16, and 32

1.5

8

4, 8, 16, 32, and 64

2

12

12, 24, 48, and 96

2.5

16

16, 32, 64, and 128

3

24

24, 48, 96, and 192

4.5

32

32, 64, 128, and 256

6

52

96, 192, and 384

12.5

64

128, 256, and 512

20

Specifications supported only in some regions

Important
  • The specifications contained in the following table are supported only in some regions. When you create an elastic container instance that has one of the following specifications, make sure that the corresponding specifications are supported in the specified region and zone. Otherwise, the instance cannot be created because no resources exist in the region and zone.

    The regions that support the specifications contained in the following table include: China (Hangzhou), China (Shanghai), China (Qingdao), China (Beijing), China (Zhangjiakou), China (Hohhot), China (Ulanqab), China (Shenzhen), China (Heyuan), China (Guangzhou), China (Chengdu), and Singapore.

  • You cannot use the specifications in the following table to create preemptible instances.

Number of vCPUs

Memory (GiB)

Bandwidth (bidirectional, Gbit/s, theoretical upper limit)

2

6, 10, 12, and 14

1

4

6, 10, 12, 14, 18, 20, 22, 24, 26, 28, and 30

1.5

6

6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, and 48

1.5

8

10, 12, 14, 18, 20, 22, 24, 26, 28, 30, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, and 62

2.5

Specify the number of vCPUs and memory size for containers in an elastic container instance

You can create a maximum of 20 containers within each elastic container instance and specify the vCPU and memory specifications of each container. For each elastic container instance, the total vCPU and memory specifications of all containers must be lower than or equal to the vCPU and memory specifications of the instance. If the total vCPU or memory specifications of all containers are higher than the vCPU or memory specifications of the instance, the system adjusts the container specifications and then charges you based on the new specifications.

Note

Elastic Container Instance allows you to set environment variables for a specific container, such as a sidecar container, to ignore the container when the system adjusts resources. This prevents waste of resources. For more information, see Ignore specific containers when the system adjusts the specifications for an elastic container instance.

OpenAPI

When you call the CreateContainerGroup API operation to create an elastic container instance, you can use the Container.N.Cpu and Container.N.Memory parameters to specify the number of vCPUs and memory size for each container. The following table describes these parameters. For more information, see CreateContainerGroup.

Parameter

Type

Example

Description

Container.N.Cpu

number

2

The number of vCPUs that you want to allocate to container N. N specifies the serial number of the container. Maximum value of N: 20.

Container.N.Memory

number

4

The memory size that you want to allocate to container N. Unit: GiB N specifies the serial number of the container. Maximum value of N: 20.

Console mode

When you create an elastic container instance in the Elastic Container Instance console, you can configure the number of vCPUs and memory size of each container in the Advanced Settings section for the container. The sum of vCPUs and sum of memory size of all containers in an elastic container instance must be smaller than or equal to the vCPU and memory size of the instance.

容器组配置

Specify the number of vCPUs and memory size for an elastic container instance

When this method is used, the system tries a variety of ECS instance types based on the specified number of vCPUs and memory size to select a suitable ECS instance type for better elasticity and resource provisioning. This method provides the following benefits:

  • You do not need to specify the number of vCPUs, memory size, or resource limits for containers in the elastic container instance. This provides the containers with greater flexibility to share the requested resources.

  • In genetic computation and Istio scenarios, the service framework automatically deploys sidecar containers in pods. You can seamlessly connect Elastic Container Instance to the service framework by specifying the number of vCPUs and memory size for elastic container instances.

Note

Some specifications cannot be configured in the Elastic Container Instance console. If you cannot select a specification that is supported by Elastic Container Instance in the console, you can use the API mode.

OpenAPI

When you call the CreateContainerGroup API operation to create an elastic container instance, you can use the Cpu and Memory parameters to specify the number of vCPUs and memory size for the elastic container instance. The following table describes these parameters. For more information, see CreateContainerGroup.

Parameter

Type

Example

Description

Cpu

number

2

The number of vCPUs that you want to allocate to the instance.

Memory

number

4

The memory size that you want to allocate to the instance. Unit: GiB

Console mode

When you create an elastic container instance in the Elastic Container Instance console, you can select the number of vCPUs and memory size of the elastic container instance (container group) on the Basic Mode tab in the Container Group Configurations section.

选择规格.png