模板名称
ACS-ECS-CreateImageAndUpdateLaunchTemplates 创建ECS镜像并更新启动模板
模板描述
创建ECS镜像并更新启动模板
模板类型
自动化
所有者
Alibaba Cloud
输入参数
参数名称 | 描述 | 类型 | 是否必填 | 默认值 | 约束 |
instanceId | ECS实例ID | String | 是 | ||
regionId | 地域ID | String | 否 | {{ ACS::RegionId }} | |
targetImageName | 新镜像的名称 | String | 否 | CreateImage_from_{{instanceId}} | |
launchTemplateNames | 待更新的实例启动模板名称列表 | List | 否 | [] | |
tags | 镜像标签 | Json | 否 | [] | |
deleteSourceTemplateVersion | 删除启动模板的原版本 | Boolean | 否 | True | |
rateControl | 任务执行的并发比率 | Json | 否 | {‘Mode’: ‘Concurrency’, ‘MaxErrors’: 0, ‘Concurrency’: 5} | |
OOSAssumeRole | OOS扮演的RAM角色 | String | 否 | “” |
输出参数
参数名称 | 描述 | 类型 |
imageIds | List |
执行此模板需要的权限策略
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:CreateImage",
"ecs:CreateLaunchTemplateVersion",
"ecs:DeleteLaunchTemplateVersion",
"ecs:DescribeDisks",
"ecs:DescribeImages",
"ecs:DescribeInstances",
"ecs:DescribeLaunchTemplateVersions",
"ecs:DescribeLaunchTemplates",
"ecs:ModifyLaunchTemplateDefaultVersion"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
详情
ACS-ECS-CreateImageAndUpdateLaunchTemplates详情
模板内容
FormatVersion: OOS-2019-06-01
Description:
name-en: ACS-ECS-CreateImageAndUpdateLaunchTemplates
name-zh-cn: 创建ECS镜像并更新启动模板
en: Creates an ECS image and update launch template
zh-cn: 创建ECS镜像并更新启动模板
categories:
- image_manage
Parameters:
regionId:
Type: String
Label:
en: RegionId
zh-cn: 地域ID
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
instanceId:
Label:
en: InstanceId
zh-cn: ECS实例ID
Type: String
AssociationProperty: ALIYUN::ECS::Instance::InstanceId
AssociationPropertyMetadata:
RegionId: regionId
targetImageName:
Label:
en: TargetImageName
zh-cn: 新镜像的名称
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: <p class="p">注意:</p> <ul class="ul"> <li class="li">长度为2~128个英文或中文字符</li> <li class="li"><font color='red'>必须以大小字母或中文开头,不能以http://和https://开头。</font></li> <li class="li">可以包含数字、半角冒号(:)、下划线(_)或者短划线(-)。</li> </ul>
Default: CreateImage_from_{{instanceId}}
launchTemplateNames:
Description:
en: <font color='red'><b>Must correspond to the selected region</b></font>
zh-cn: <font color='red'><b>必须要在所选的地域</b></font>
Label:
en: LaunchTemplateNames
zh-cn: 待更新的实例启动模板名称列表
Type: List
Default: []
tags:
Label:
en: Tags
zh-cn: 镜像标签
Type: Json
AssociationProperty: Tags
AssociationPropertyMetadata:
ShowSystem: false
Default: []
deleteSourceTemplateVersion:
Label:
en: DeleteSourceTemplateVersion
zh-cn: 删除启动模板的原版本
Type: Boolean
Default: true
rateControl:
Label:
en: RateControl
zh-cn: 任务执行的并发比率
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 5
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: OOS扮演的RAM角色
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: 通过指定实例ID和镜像名称创建新的镜像
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ instanceId }}'
imageName: '{{ targetImageName }}_on_{{ ACS::ExecutionId }}_at_{{ Acs::CurrentDate }}'
tags: '{{tags}}'
Outputs:
imageId:
ValueSelector: imageId
Type: String
- Name: describeDisks
Action: 'ACS::ExecuteAPI'
Description:
en: Get disk info of the ECS instance
zh-cn: 查看实例的磁盘信息
Properties:
Service: ECS
API: DescribeDisks
Parameters:
RegionId: '{{ regionId }}'
InstanceId: '{{ instanceId }}'
Outputs:
systemDiskSize:
Type: String
ValueSelector: '.Disks.Disk[] | select(.Type == "system" )|.Size'
systemDiskPerformanceLevel:
Type: String
ValueSelector: '.Disks.Disk[] | select(.Type == "system" )|.PerformanceLevel'
systemDiskDeleteWithInstance:
Type: Boolean
ValueSelector: '.Disks.Disk[] | select(.Type == "system" )|.DeleteWithInstance'
- Name: updateLaunchTemplate
Action: 'ACS::ECS::UpdateLaunchTemplate'
Description:
en: Update instance launch template
zh-cn: 更新实例启动模板
Properties:
regionId: '{{ regionId }}'
imageId: '{{ createImage.imageId }}'
launchTemplateName: '{{ ACS::TaskLoopItem }}'
deleteSourceTemplateVersion: '{{ deleteSourceTemplateVersion }}'
systemDiskSize: '{{ describeDisks.systemDiskSize}}'
systemDiskPerformanceLevel: '{{ describeDisks.systemDiskPerformanceLevel }}'
systemDiskDeleteWithInstance: '{{ describeDisks.systemDiskDeleteWithInstance }}'
Loop:
Items: '{{ launchTemplateNames }}'
Outputs:
imageIds:
Type: List
Value: '{{ createImage.imageId }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- regionId
- instanceId
Label:
default:
zh-cn: 选择实例
en: Select Ecs Instances
- Parameters:
- targetImageName
- tags
Label:
default:
zh-cn: 镜像设置
en: Image Configure
- Parameters:
- launchTemplateNames
- deleteSourceTemplateVersion
Label:
default:
zh-cn: 启动模板
en: Launch Template
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
zh-cn: 高级选项
en: Control Options
文档内容是否对您有帮助?