Instead of pinning your pod to a specific ECS instance type, specify only the vCPU count and memory size. Elastic Container Instance (ECI) then selects from multiple compatible ECS instance types automatically, giving you better resource availability and elasticity.
How resource sizing works
When you create a pod, ECI maps the requested vCPU and memory to a supported specification. If the exact combination is not available, ECI rounds up to the next supported specification — the result is always greater than or equal to what you requested. For example, requesting 7 vCPUs and 13 GiB produces an instance with 8 vCPUs and 14 GiB.
All specifications include 30 GiB of temporary storage and one elastic network interface (ENI) by default. If no resource configuration is set, ECI creates the pod with 2 vCPUs and 4 GiB of memory.
Supported specifications
Available in all regions
| vCPU | Memory (GiB) | Bandwidth (bidirectional, Gbit/s, theoretical upper limit) |
|---|---|---|
| 0.25 | 0.5, 1 | 0.08 |
| 0.5 | 1, 2 | 0.08 |
| 1 | 2, 4, 8 | 0.1 |
| 2 | 1, 2, 4, 8, 16 | 1 |
| 4 | 2, 4, 8, 16, 32 | 1.5 |
| 8 | 4, 8, 16, 32, 64 | 2 |
| 12 | 12, 24, 48, 96 | 2.5 |
| 16 | 16, 32, 64, 128 | 3 |
| 24 | 24, 48, 96, 192 | 4.5 |
| 32 | 32, 64, 128, 256 | 6 |
| 52 | 96, 192, 384 | 12.5 |
| 64 | 128, 256, 512 | 20 |
Available in select regions only
The specifications below are supported only in the following regions: China (Hangzhou), China (Shanghai), China (Qingdao), China (Beijing), China (Zhangjiakou), China (Hohhot), China (Ulanqab), China (Shenzhen), China (Heyuan), China (Guangzhou), China (Chengdu), and Singapore. If the region or zone you specify does not have capacity for the requested specification, pod creation fails. These specifications cannot be used for preemptible instances.
| vCPU | Memory (GiB) | Bandwidth (bidirectional, Gbit/s, theoretical upper limit) |
|---|---|---|
| 2 | 6, 10, 12, 14 | 1 |
| 4 | 6, 10, 12, 14, 18, 20, 22, 24, 26, 28, 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, 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, 62 | 2.5 |
Configuration methods
Two methods let you set vCPU and memory for a pod:
| Method | Set on | Use when |
|---|---|---|
Container limits or requests | Per container | You need per-container resource control or quotas |
k8s.aliyun.com/eci-use-specs annotation | Per pod | Containers share resources freely, or sidecar containers are injected automatically (for example, in Istio or genomics pipelines) |
When both methods are configured, eci-use-specs takes precedence. The full priority order is:
| Configuration | Pod specification used |
|---|---|
| None of the parameters set | 2 vCPUs, 4 GiB |
limits only | Sum of limits across all containers |
requests only | Sum of requests across all containers |
limits and requests | Sum of limits across all containers (requests is ignored) |
eci-use-specs only | Value of eci-use-specs |
eci-use-specs with limits or requests | Value of eci-use-specs |
If the resulting pod specification is not in the supported list, ECI rounds it up and bills you based on the adjusted specification.
Set resources per container
This is the standard Kubernetes approach. Each container in the pod declares its own resources block, and ECI sums the values across all containers to determine the pod specification. A pod can have up to 20 containers, and the total vCPU and memory specifications of all containers must be lower than or equal to the vCPU and memory specifications of the pod.
Understanding `limits` vs. `requests`
`limits`: The maximum CPU or memory a container can use. ECI uses
limitsto calculate the pod specification. Becauselimitsgives a precise upper bound, uselimitswhenever possible.`requests`: The minimum amount reserved for the container. When set alone, ECI uses
requeststo size the pod.
apiVersion: apps/v1
kind: Deployment
metadata:
name: test
labels:
app: test
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
name: test
labels:
app: nginx
alibabacloud.com/eci: "true"
spec:
containers:
- name: nginx
image: registry.cn-shanghai.aliyuncs.com/eci_open/nginx:1.14.2
ports:
- containerPort: 80
resources:
limits:
cpu: "500m" # 0.5 vCPU for the nginx container
memory: "1024Mi" # 1 GiB for the nginx container
- name: busybox
image: registry.cn-shanghai.aliyuncs.com/eci_open/busybox:1.30
command: ["sleep"]
args: ["999999"]
resources:
limits:
cpu: "1000m" # 1 vCPU for the busybox container
memory: "2048Mi" # 2 GiB for the busybox container
# Combined: 1.5 vCPUs, 3 GiB total -> ECI rounds up to the nearest supported specTo prevent a specific container (such as a sidecar) from being counted when ECI sizes the pod, set an environment variable on that container to exclude it. For details, see Ignore specific containers when the system adjusts resources.
Set resources for the entire pod
Add the k8s.aliyun.com/eci-use-specs annotation to the pod's metadata section to set vCPU and memory at the pod level. Container-level limits and requests are optional with this method — containers share the pod's resources freely.
This method works well when:
Sidecar containers are injected automatically by a service mesh (Istio) or a genomics framework, making per-container sizing impractical.
You want to decouple resource allocation from individual container definitions.
apiVersion: apps/v1
kind: Deployment
metadata:
name: test
labels:
app: test
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
name: test
labels:
app: nginx
alibabacloud.com/eci: "true"
annotations:
k8s.aliyun.com/eci-use-specs: "2-4Gi" # 2 vCPUs, 4 GiB for the entire pod
spec:
containers:
- name: nginx
image: registry.cn-shanghai.aliyuncs.com/eci_open/nginx:1.14.2
ports:
- containerPort: 80
- name: busybox
image: registry.cn-shanghai.aliyuncs.com/eci_open/busybox:1.30
command: ["sleep"]
args: ["999999"]
resources:
limits:
cpu: "500m" # Optional: cap individual container usage
memory: "1024Mi"If you need to restrict which ECS instance families ECI selects from (for example, sixth-generation families only), add a separate annotation to specify instance family generations. For details, see Specify generations of ECS instance families to create pods.