All Products
Search
Document Center

Auto Scaling:Create a scaling configuration for an ECI scaling group

Last Updated:May 14, 2026

If your scaling group is of the ECI type, you can create a scaling configuration that serves as a template for the Elastic Container Instance (ECI) instances created during a scale-out. When a scale-out event is triggered, Auto Scaling automatically creates ECI instances based on this scaling configuration. You can create an ECI scaling configuration by using a form or a YAML file.

Prerequisites

  • An ECI scaling group is created. For more information, see Configure scaling groups.

  • A security group is created. If the scaling group uses a VPC, ensure the security group and the scaling group are in the same VPC. For more information, see Create a security group.

Procedure

You can create a scaling configuration for an ECI scaling group in several ways. Choose the method that best fits your requirements.

Method 1: By form

  1. Go to the Create Scaling Configuration page.

    1. Log on to the Auto Scaling console.

    2. In the navigation pane on the left, click Scaling Groups.

    3. In the top navigation bar, select a region.

    4. On the Scaling Groups page, find the scaling group that you want to manage and click View Details in the Actions column.

    5. Click the Instance Configuration Source tab, and on the Scaling Configurations tab, click Create Scaling Configuration to open the Create Scaling Configuration page.

  2. On the Create Scaling Configuration page, click the Create by Form tab and fill in the basic settings. Then, click Next: Other Settings.

    For information about the parameters, see Basic settings.

  3. (Optional) Configure other settings.

    For information about the parameters, see Other settings.

  4. Click Confirm Configuration. Verify the settings and then click Create Order.

  5. (Optional) Enable the scaling configuration.

    After you click Create Order, the The scaling configuration is created. dialog box appears. You can click Enable to immediately enable the scaling configuration.

    Note

    If you do not want the configuration to take effect immediately, you can enable it later from the list of scaling configurations. For more information, see Select and enable a scaling configuration.

Method 2: By Kubernetes YAML file

Console

  1. Go to the Create Scaling Configuration page.

    1. Log on to the Auto Scaling console.

    2. In the navigation pane on the left, click Scaling Groups.

    3. In the top navigation bar, select a region.

    4. On the Scaling Groups page, find the scaling group that you want to manage and click View Details in the Actions column.

    5. Click the Instance Configuration Source tab, and on the Scaling Configurations tab, click Create Scaling Configuration to open the Create Scaling Configuration page.

  2. On the Create Scaling Configuration page, click the Create by YAML File tab. Write the YAML file.

    You can use the following example to help you write the YAML file.

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: nginx-demo
      annotations:
        # The name of the scaling configuration.
        k8s.aliyun.com/ess-eci-scaling-configuration-name: create-ess-config-by-yaml
    spec:
      # This template defines the ECI instances to be created.
      template:
        metadata:
          labels:
              app: nginx-demo
          annotations:
            # The vSwitch ID. You can specify up to eight vSwitches in the same VPC. Separate multiple vSwitch IDs with commas (,).
            k8s.aliyun.com/eci-vswitch: vsw-bp******1,vsw-bp******2,vsw-bp******3,vsw-bp******4
            # The security group ID. You can specify up to five security groups in the same VPC. Separate multiple security group IDs with commas (,).
            k8s.aliyun.com/eci-security-group: sg-bp******1,sg-bp******2
            # Specifies whether to automatically create and associate an EIP.
            k8s.aliyun.com/eci-with-eip: 'true'
            # The ECI instance types.
            k8s.aliyun.com/eci-use-specs: 1.0-2.0Gi
            # The bandwidth of the EIP.
            k8s.aliyun.com/eip-bandwidth: '5'
        spec:
          containers:
            - name: nginx
              # The image.
              image: nginx:latest
              ports:
                - containerPort: 80
                  name: http
                - containerPort: 443
                  name: https
              resources:
                requests:
                  memory: 0.05Gi
                  cpu: 50m
                limits:
                  memory: 2Gi
                  cpu: '2'

    The following table describes the parameters in this YAML file. For a description of all supported parameters, see YAML parameters.

    YAML parameters for instances

    Parameter

    Description

    Example

    k8s.aliyun.com/ess-eci-scaling-configuration-name

    The name of the scaling configuration.

    create-ess-config-by-yaml

    k8s.aliyun.com/eci-vswitch

    The ID of the vSwitch. You can specify up to eight vSwitches in the same VPC. Separate multiple vSwitch IDs with commas (,).

    Important

    If you do not specify a VPC and a vSwitch, Auto Scaling uses or creates a default VPC and vSwitch. For more information, see Default VPCs and vSwitches.

    vsw-bp******1,vsw-bp******2,vsw-bp******3

    k8s.aliyun.com/eci-security-group: sg-bp******

    The ID of the security group. You can specify up to five security groups in the same VPC. Separate multiple security group IDs with commas (,).

    Important

    The security group and the vSwitch must be in the same VPC.

    sg-bp******1,sg-bp******2

    k8s.aliyun.com/eci-with-eip

    Specifies whether to automatically associate an EIP with the instance. Set the value to true to enable this feature.

    true

    k8s.aliyun.com/eci-use-specs

    The ECI instance types. You can specify multiple types, including vCPU and memory specifications, or ECS instance types.

    1.0-1.0Gi

    k8s.aliyun.com/eip-bandwidth

    The bandwidth of the EIP. Unit: Mbit/s. The default value is 5 Mbit/s.

    5

  3. Click Create. In the confirmation dialog box, click Create Order to create the scaling configuration.

  4. (Optional) Enable the scaling configuration.

    After you click Create Order, the Apply Scaling Configuration dialog box appears. You can click OK to immediately enable the scaling configuration.

    Note

    If you do not want the configuration to take effect immediately, you can enable it later from the list of scaling configurations. For more information, see Select and enable a scaling configuration.

Alibaba Cloud CLI

You can use Alibaba Cloud CLI to manage scaling configurations from the command line. The following steps describe how to use a YAML file to create a scaling configuration for ECI instances. This example uses the nginx:latest image.

Important

Before you begin, make sure that you have installed Alibaba Cloud CLI and configured your Alibaba Cloud CLI credentials and environment variables. For more information, see What is Alibaba Cloud CLI?.

  1. Create a file named create-ess-config.yaml.

    You can use the following example to help you write the YAML file.

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: nginx-demo
      annotations:
        # The name of the scaling configuration.
        k8s.aliyun.com/ess-eci-scaling-configuration-name: create-ess-config-by-yaml
    spec:
      # This template defines the ECI instances to be created.
      template:
        metadata:
          labels:
              app: nginx-demo
          annotations:
            # The vSwitch ID. You can specify up to eight vSwitches in the same VPC. Separate multiple vSwitch IDs with commas (,).
            k8s.aliyun.com/eci-vswitch: vsw-bp******1,vsw-bp******2,vsw-bp******3,vsw-bp******4
            # The security group ID. You can specify up to five security groups in the same VPC. Separate multiple security group IDs with commas (,).
            k8s.aliyun.com/eci-security-group: sg-bp******1,sg-bp******2
            # Specifies whether to automatically create and associate an EIP.
            k8s.aliyun.com/eci-with-eip: 'true'
            # The ECI instance types.
            k8s.aliyun.com/eci-use-specs: 1.0-2.0Gi
            # The bandwidth of the EIP.
            k8s.aliyun.com/eip-bandwidth: '5'
        spec:
          containers:
            - name: nginx
              # The image.
              image: nginx:latest
              ports:
                - containerPort: 80
                  name: http
                - containerPort: 443
                  name: https
              resources:
                requests:
                  memory: 0.05Gi
                  cpu: 50m
                limits:
                  memory: 2Gi
                  cpu: '2'

    The following table describes the parameters in this YAML file. For a description of all supported parameters, see YAML parameters.

    YAML parameters for instances

    Parameter

    Description

    Example

    k8s.aliyun.com/ess-eci-scaling-configuration-name

    The name of the scaling configuration.

    create-ess-config-by-yaml

    k8s.aliyun.com/eci-vswitch

    The ID of the vSwitch. You can specify up to eight vSwitches in the same VPC. Separate multiple vSwitch IDs with commas (,).

    Important

    If you do not specify a VPC and a vSwitch, Auto Scaling uses or creates a default VPC and vSwitch. For more information, see Default VPCs and vSwitches.

    vsw-bp******1,vsw-bp******2,vsw-bp******3

    k8s.aliyun.com/eci-security-group: sg-bp******

    The ID of the security group. You can specify up to five security groups in the same VPC. Separate multiple security group IDs with commas (,).

    Important

    The security group and the vSwitch must be in the same VPC.

    sg-bp******1,sg-bp******2

    k8s.aliyun.com/eci-with-eip

    Specifies whether to automatically associate an EIP with the instance. Set the value to true to enable this feature.

    true

    k8s.aliyun.com/eci-use-specs

    The ECI instance types. You can specify multiple types, including vCPU and memory specifications, or ECS instance types.

    1.0-1.0Gi

    k8s.aliyun.com/eip-bandwidth

    The bandwidth of the EIP. Unit: Mbit/s. The default value is 5 Mbit/s.

    5

  2. In the same directory as the create-ess-config.yaml file, run the following command to create the scaling configuration.

    Important

    Modify the following parameters as needed:

    • Set --RegionId to the ID of the region where your scaling group is located. This example uses cn-hangzhou.

    • Set --ScalingGroupId to your scaling group ID. This example uses asg-bp******v.

    aliyun ess ApplyEciScalingConfiguration --RegionId cn-hangzhou --ScalingGroupId asg-bp******v --Content "$(cat create-ess-config.yaml)" --version 2022-02-22 --method POST --force

Parameters

Basic settings

Parameter

Description

Related topics

Billing Method

Select the billing method for the instances in your scaling group. After you set the Billing Method, newly created instances are billed based on this method. The configuration items are described as follows:

  • Pay-as-you-go: Create and release resources on demand, paying only for what you use with no upfront commitment.

  • Spot Instance: The price of a spot instance fluctuates with supply and demand. Spot instances offer a discount compared with pay-as-you-go instances but may be automatically reclaimed. You can use spot instances to significantly reduce costs.

Billing overview

Configuration Information

The region, VPC, and vSwitch of the ECI instance. These values are automatically populated to match the scaling group's configuration.

N/A

Security Group

Instances created during a scale-out are automatically added to the selected security group.

Create a security group

Container Group Configuration

In this section, you can configure the instance types for ECI instances. Two modes are supported:

  • Basic mode

    This mode allows you to directly specify the resources that an ECI instance requires, including vCPUs and memory, and enable features such as image cache and cost optimization.

  • Specify instance type

    If your business has specific requirements for instance specifications, such as GPUs, you can specify ECS instance types to create ECI instances. For more information, see Specify ECS instance types to create an instance.

If you need to add a storage volume to an ECI instance, you can configure it in the Advanced Settings section based on your requirements. For more information about the configuration, see Volume overview.

Container Configuration

In this section, you can configure the containers in a container group. The configurations include adding multiple containers, configuring container images, and selecting versions, image pull policies, and image startup commands.

You can also specify the resources required by the container and configure environment variables and storage in the advanced settings.

Other settings

Parameter

Description

Related topics

EIP

If you enable this option, newly created ECI instances are automatically associated with an elastic IP address (EIP) to provide Internet access.

Configure Internet access for an ECI instance

Credential

If your container uses an image from a private image repository, you must configure credentials to allow the system to pull the image.

N/A

RAM Role

If the ECI instances in your scaling group need to access other Alibaba Cloud services, you must assign a RAM role to them. Grant permissions to this role to control instance access to other cloud resources.

Associate a RAM role with an ECI pod

Tag

After you configure tags, all newly scaled-out ECI instances are associated with these tags. Tags allow for more granular management and filtering of your instances.

Manage ECI instances by using tags

Resource Group

After you configure a resource group, all newly scaled-out ECI instances are created in this resource group. You can use resource groups to control the permissions of RAM users.

Implement RAM user authorization by using resource groups

Scaling configuration name

The name of the scaling configuration. If you leave this parameter empty, the scaling configuration ID is used by default.

N/A

Related topics