If you are creating one of the four following ECS resource types, you must specify an image for the instance.

There are three methods to specify an image using the template:

  • Specify an image ID.
  • Specify an image with fuzzy match.
  • Select an image through AssociationProperty.

Specify an image ID

If you know which image you want and its ID, specify the ImageId in the template. You can view available image IDs for each region in the Resource Orchestration Service (ROS) console.

  1. Log on to the ROS console.
  2. Click ECS Instance Information in the left-side navigation pane. On the ECS Instance Information page, click ECS Image. A list of available images appears. Copy the image ID you want.
  3. Specify the image ID as the value of ImageId in the template.

    Examples

"ImageId": { "Type": "String", "Description": "Image Id, represents the image used to startup the ECS instance", "Default ": "centos_7_04_64_20G_alibase_201701015.vhd" },

Specify an image with fuzzy match

If you do not require a particular image, you can use fuzzy match to specify an image ID. For example, you are fine with any version of the CentOS or Ubuntu operating system. ROS uses the value you entered to find the best match.

ROS uses the following rules to find a match:

  • If you only specify an image series, such as CentOS, Win, or Ubuntu, ROS matches the latest 64-bit image version.
  • If you specify a series and a version family, such as CentOS_6, Ubuntu_14, or Win2008r2, ROS matches the latest 64-bit version of the series and version family (CentOS 6, Ubuntu 14, or Win2008r2).
  • 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 through AssociationProperty

Include AssociationProperty as part of your image ID definition when you declare it as one of the Parameters. Then, ROS lists all available images of a region for you to select when creating 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": "Automatically lists available image IDs."
    }

			

When it comes to entering an image ID for the resource you are creating, all available image IDs of the region are listed as shown in the following figure:

In addition to the available image IDs, the system displays the default image ID, or whether the value specified in AllowedValues is available. Select the appropriate image ID to create ECS instances.