All Products
Search
Document Center

Specify an ECS instance type to create an elastic container instance

Last Updated: May 24, 2021

In some scenarios, you may have specific specification requirements such as for GPUs, enhanced network capabilities, high clock speeds, and local disks. To meet these requirements, you can create an elastic container instance by specifying an Elastic Compute Service (ECS) instance type.

Background information

When you specify an ECS instance type to create an elastic container instance, the compute resources consumed by the elastic container instance are billed at the rate of the specified ECS instance type.

The following ECS instance families are supported:

  • General purpose instance families: g6e, g6, g5, sn2, and sn2ne

  • Compute optimized instance families: c6e, c6a, c6, c5, sn1, and sn1ne

  • Memory optimized instance families: r6e, r6, r5, se1ne, and se1

  • Compute intensive instance family: ic5

  • Compute optimized instance families with high clock speeds: hfc6 and hfc5

  • General purpose instance families with high clock speeds: hfg6 and hfg5

  • GPU-accelerated compute optimized instance families: gn6i, gn6v, gn5i, and gn5

  • Big data instance family with enhanced network performance: d1ne

  • Instance families with local SSDs: i2 and i2g

  • Burstable instance families: t6 and t5

  • Shared instance families: s6, xn4, n4, mn4, n1, n2, e3, and e4

For more information, see:

Kubernetes mode

You can add annotations to metadata in the configuration file of the pod to specify an ECS instance type. Sample code:

apiVersion: apps/v1 # for versions before 1.8.0 use apps/v1beta1
kind: Deployment
metadata:
  name: nginx-deployment-basic
  labels:
    app: nginx
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
      annotations:
        k8s.aliyun.com/eci-use-specs: ecs.c5.large  #Specify an ECS instance type.
    spec:
      containers:
      - name: nginx
        image: nginx:1.7.9 # replace it with your exactly <image_name:tags>
        ports:
        - containerPort: 80
     nodeName: virtual-kubelet    #Specify a virtual node name to schedule the pod to Elastic Container Instance in a Container Service for Kubernetes (ACK) cluster.

API mode

When you call the CreateContainerGroup operation to create an elastic container instance, you can use the InstanceType parameter to specify one or more ECS instance types. The following table describes the parameter. For more information, see CreateContainerGroup.

Parameter

Type

Required

Example

Description

InstanceType

String

No

ecs.c5.xlarge,ecs.g5.xlarge

The ECS instance types. You can specify up to five ECS instance types at a time. Separate multiple instance types with commas (,). Example: ecs.c5.xlarge,ecs.g5.xlarge.