Template name
ACS-ECS-CreateImage
Template description
Creates an Elastic Compute Service (ECS) image. This applies to scenarios in which you need to create ECS images, such as system backup and migration. When you configure this template, you must specify the following parameters: regionId: the region where you want to create an image, instanceId: the ECS instance for which you want to create an image, and whetherOnlySystemDisk: specifies whether to create only a system disk image. After the image is created, the image ID is returned.
Template type
Automated
Owner
Alibaba Cloud
Input parameters
Parameter | Description | Type | Required | Default value | Limit |
instanceId | The ID of the ECS instance. | String | Yes | ||
imageName | The name of the image to be created. | String | Yes | ||
regionId | The region ID. | String | No | {{ ACS::RegionId }} | |
tags | The tags of the image. | Json | No | [] | |
OOSAssumeRole | The Resource Access Management (RAM) role that is assumed by CloudOps Orchestration Service (OOS). | String | No | "" |
Output parameters
Parameter | Description | Type |
imageId | String |
Permission policy that is required to execute the template
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:CreateImage",
"ecs:DescribeImages",
"ecs:DescribeInstances"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
References
For more information, see ACS-ECS-CreateImage.yml at GitHub.
Template content
FormatVersion: OOS-2019-06-01
Description:
en: 'Creates an ECS image, applicable to scenarios requiring the creation of a custom image from an existing ECS instance, such as for backup and system migration. During configuration, users need to provide the following required parameter information: Region ID (regionId), which specifies the region of the ECS instance for which the image will be created, ECS Instance ID (instanceId), which identifies the instance from which the image will be created, and Image Name (imageName). Users can also choose whether to create an image only from the system disk (whetherOnlySystemDisk). After the image creation, the template will return the ID of the newly created image.'
zh-cn: the description in Chinese
name-en: Create Image
name-zh-cn: the description in Chinese
categories:
- image_manage
- application_manage
Parameters:
regionId:
Type: String
Label:
en: RegionId
zh-cn: the description in Chinese
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
instanceId:
Label:
en: InstanceId
zh-cn: the description in Chinese
Type: String
AssociationProperty: ALIYUN::ECS::Instance::InstanceId
AssociationPropertyMetadata:
RegionId: regionId
imageName:
Label:
en: ImageName
zh-cn: the description in Chinese
Type: String
Description:
en: <p class="p">Note:</p> <ul class="ul"> <li class="li">Length is 2~128 English or Chinese characters</li> <li class="li"><font color='red'>must start with big or small letters or Chinese, not http:// and https://. </font></li> <li class="li">Can contain numbers, colons (:), underscores (_), or dashes (-). </li> </ul>
zh-cn: the description in Chinese </li> </ul>
tags:
Label:
en: Tags
zh-cn: the description in Chinese
Type: Json
AssociationProperty: Tags
AssociationPropertyMetadata:
ShowSystem: false
Default: []
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: the description in Chinese
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: createImage
Action: ACS::ECS::CreateImage
Description:
en: Create new image with the specified image name and instance ID
zh-cn: the description in Chinese
Properties:
regionId: '{{ regionId }}'
imageName: '{{ imageName }}__on_{{ ACS::ExecutionId }}_at_{{ Acs::CurrentDate }}'
instanceId: '{{ instanceId }}'
tags: '{{tags}}'
Outputs:
imageId:
ValueSelector: imageId
Type: String
Outputs:
imageId:
Type: String
Value: '{{ createImage.imageId }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- regionId
- instanceId
Label:
default:
zh-cn: the description in Chinese
en: Select Ecs Instances
- Parameters:
- imageName
- tags
Label:
default:
zh-cn: the description in Chinese
en: Image Configure
- Parameters:
- OOSAssumeRole
Label:
default:
zh-cn: the description in Chinese
en: Control Options