All Products
Search
Document Center

Specify an ECS instance type to create an elastic container instance

Last Updated: May 19, 2022

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, you are charged for the compute resources that are consumed by the elastic container instance based on the rate of the 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 family: gn7i, gn7, gn6i, gn6e, 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: xn4, n4, mn4, n1, n2, e3, and e4.

Notice

If you use burstable instance families, take note of the following items:

  • Burstable instances use CPU credits to maintain computing performance and are suitable for scenarios in which CPU utilization is typically low but experiences occasional bursts. For more information, see Overview.

  • You cannot modify ulimit.

For more information, see the following references:

Use Kubernetes to specify an ECS instance type

You can add annotations to metadata in the configuration file of the pod to specify an ECS instance type. The following sample code shows how to specify an ECS instance type by using Kubernetes:

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 run on the elastic container instance in a Container Service for Kubernetes (ACK) cluster.

Call an API operation to specify an ECS instance type

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.