All Products
Search
Document Center

Resource Orchestration Service:How to specify an image for an ECS resource

Last Updated:Aug 11, 2026

This topic describes how to specify an image for an ECS resource using Resource Orchestration Service (ROS).

Prerequisites

Before you begin, make sure that you have an Alibaba Cloud account. If you do not have an account, create one.

Background information

You must specify an image when you create an ECS instance using one of the following four resource types:
When you edit a stack template, you can specify the image ID (ImageId) in one of the following three ways:
  • Directly specify the required image ID.
  • Specify the image ID using a fuzzy match.
  • Select an available image using the AssociationProperty property for the image parameter.

Directly specify the required image ID

If you know the exact image ID that you want to use, you can specify it directly.

  1. Log on to the ECS console.
  2. In the navigation pane, choose Instances & Images > Images.
  3. Click Public Images.
    A list of available image IDs is displayed. Find and record the ID of the image that you want to use.
  4. In the ROS template, set the ImageId property to the image ID that you recorded.
    For more information, see Create a template.
    "ImageId": { "Type": "String", "Description": "Image Id, represents the image resource to startup one ECS instance", "Default": "centos_7_04_64_20G_alibase_201701015.vhd" },

Specify an image ID using a fuzzy match

If you do not require a specific image version, such as a particular CentOS or Ubuntu image, you can use a fuzzy match to specify the image ID. ROS automatically selects the most suitable image ID based on your input.

The matching rules are as follows:

  • If you specify only the image family, such as CentOS, Windows, or Ubuntu, ROS selects the latest 64-bit version of the image.
  • If you specify both the image family and the major version, such as CentOS_6, Ubuntu_14, or Windows2008r2, ROS selects the latest 64-bit version for that major version.
  • You can use an asterisk (*) as a wildcard. For example, if you specify centos_6_09_64_20G_alibase*.vhd, ROS uses the latest version of the centos_6_09_64_20G_alibase public image. Fuzzy matching is used in many ROS template examples. For example, CentOS_7 or Ubuntu_14 is often used in templates that require an image to be specified.

For example:

"ImageId": {
   "Type": "String",
   "Description": "ECS Image",
   "Label": "ECS Image",
   "Default": "cent****"
 },

Use the AssociationProperty property to select an available image

If you define the ECS image ID as a template parameter, you can add the AssociationProperty property to the parameter definition. When ROS parses the template, it automatically displays a drop-down list of available image IDs for the current region. You can then select an image ID from the drop-down list.

The following code provides an example of how to define a parameter using AssociationProperty:

   "ImageId": {
      "AssociationProperty":"ALIYUN::ECS::Instance:ImageId",
      "Type" : "String",
      "Default": "centos_7_04_64_20G_alibase_20170****.vhd",
      "Description": "Automatically retrieves the selectable image IDs"
    }            

In addition to providing a drop-down list, ROS also indicates whether the value specified for the Default property or the values specified in the AllowedValues property are available in the current region. You can then select a suitable image ID to create the ECS resource.