This topic describes how to use reserve instances to reduce the costs of long-running Elastic Container Instances (ECIs). We recommend that you use reserve instances to reduce the costs of ECIs for running long-term online business applications.
Before you begin
You can only use reserve instances to create ECIs of the specified Elastic Compute Service (ECS) instance type. For more information, see Create an ECI of the specified ECS instance type.
1. Purchase reserved instances as needed. For more information, see Purchase reserved instances.
2. View and manage reserved instances. For more information, see Split a reserved instance.

Kubernetes mode
You can only use reserve instances to create ECIs of the specified ECS instance type. For more information, see Create an ECI of the specified ECS instance type.
- Log on to the Container Service console. In this example, choose Applications > Deployments in the left-side navigation pane.
- In the upper-right corner of the Deployments page, click Create from Template.
- Add the following annotation in the pod template. In this example, an ECI of the ecs.c5.large type is reserved.
Note that you need to add annotations in the metadata parameter for the pod. Specify ECS instance types as needed. For more information, see Instance families.
annotations:
k8s.aliyun.com/eci-instance-type : "ecs.c5.large" # Replace the ECS instance type as needed in the format of ecs.Instance family.Specification. Example: ecs.c6.3xlarge.
Add the annotation in the YAML file of a deployment
apiVersion: apps/v1beta2 # For versions earlier than 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-instance-type : "ecs.c5.large" # Replace the ECS instance type as needed.
spec:
# nodeSelector:
# env: test-team
containers:
- name: nginx
image: nginx:1.7.9 # Replace it with your image name, in the format of <image_name:tags>.
ports:
- containerPort: 80
View the created pod
API mode
You can only use reserve instances to create ECIs of the specified ECS instance type. For more information, see Create an ECI of the specified ECS instance type.
You need to set the InstanceType parameter in the request for calling the CreateContainerGroup operation. For more information, see CreateContainerGroup.
Request parameter
Parameter | Type | Required | Description |
---|---|---|---|
InstanceType | String | Yes | The instance type of the ECI to be created. |
View the information about the ECI
eci-2ze2f3qp626x29u2183b
.
View the bills
eci-2ze2f3qp626x29u2183b
. No bills are generated.
View the deduction details of a reserved instance
Find the target reserved instance

View the deduction details of the reserved instance
