This topic describes how to use Resource Orchestration Service (ROS) to specify images for ECS resources.

Prerequisites

An Alibaba Cloud account is created. To create an Alibaba Cloud account, go to the Alibaba Cloud official website.

Background information

If you use one of the following resource types to create ECS instances, you must specify images for the instances.
You can use one of the following methods to set the ImageId parameter in a stack template:
  • Specify an image ID.
  • Specify an image with fuzzy match.
  • Select an image by using theAssociationProperty parameter.

Specify an image ID

If you have the ID of the image that you want to use, specify the ImageId parameter in the template.

  1. Log on to the ECS console.
  2. In the left-side navigation pane, choose Instances & Images > Images.
  3. Click Public Image.
    A list of available image IDs appears.
  4. In the template, set the ImageId parameter to an image ID.
    "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 with fuzzy match

If you do not need specific versions of CentOS or Ubuntu images, you can use fuzzy match to specify an image ID. ROS uses the value you entered to find the best match.

ROS uses the following rules to find a match:

  • If you specify only the operating system of images, such as CentOS, Windows, or Ubuntu, ROS matches the latest 64-bit image version.
  • If you specify a major version of an operating system, ROS matches the latest 64-bit version of the system based on the major version. For example, if you enter CentOS_6, Ubutun_14 or Win2008r2 to search images, ROS matches the latest 64-bit version of CentOS 6, Ubuntu 14, or Windows Server 2008 R2 respectively.
  • If you use an asterisk (*) to replace a part of the image ID, such as centos_6_09_64_20G_alibase*.vhd, ROS matches the latest centos_6_09_64_20G_alibase public image version. Fuzzy match is used in the sample templates. In many cases, the image ID is specified as CentOS_7 or Ubuntu_14.

Examples:

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

Select an image by using the AssociationProperty parameter

Include AssociationProperty as part of your image ID definition when you declare it as a parameter in the Parameters section. Then, ROS lists the images of a region that you can select when you create the ECS instance.

Examples of using AssociationProperty:

   "ImageId": {
      "AssociationProperty":"ALIYUN::ECS::Instance:ImageId",
      "Type" : "String",
      "Default": "centos_7_04_64_20G_alibase_201701016.vhd",
      "Description": "IDs of available images"
    }            

In addition to the available image IDs, the system displays the default image ID, or indicates whether the values specified by AllowedValues are available. Select the appropriate image ID to create ECS instances.