Template name
ACS-ECS-BulkyReplaceSystemDisk
Template description
Replaces the system disks of multiple Elastic Compute Service (ECS) instances at a time.
Template type
Automated
Owner
Alibaba Cloud
Input parameters
Parameter | Description | Type | Required | Default value | Limit |
imageId | The image ID. | String | Yes | ||
targets | The ECS instances whose system disk you want to replace. | Json | Yes | ||
regionId | The region ID. | String | No | {{ ACS::RegionId }} | |
password | The username and password that are used to access the ECS instance. | String | No | "" | |
keyPairName | The name of the key pair. | String | No | "" | |
rateControl | The rate control settings. | Json | No | {'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} | |
OOSAssumeRole | The Resource Access Management (RAM) role that is assumed by CloudOps Orchestration Service (OOS). | String | No | "" |
Output parameters
Parameter | Description | Type |
newSystemDiskIds | String |
Permission policy that is required to execute the template
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeDisks",
"ecs:DescribeInstances",
"ecs:ReplaceSystemDisk",
"ecs:StartInstance",
"ecs:StopInstance"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
References
For more information, see AACS-ECS-BulkyReplaceSystemDisk.yml at GitHub.
Template content
FormatVersion: OOS-2019-06-01
Description:
en: Bulky replaces the system disk of ECS instances.
zh-cn: the description in Chinese
name-en: ACS-ECS-BulkyReplaceSystemDisk
name-zh-cn: the description in Chinese
categories:
- instance_manage
- application_management
Parameters:
regionId:
Type: String
Label:
en: RegionId
zh-cn: the description in Chinese
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
imageId:
Label:
en: ImageId
zh-cn: the description in Chinese
Description:
en: <div style="color:#F00">If the system disk capacity of the image you select is larger than the original system disk capacity, the system disk will be automatically expanded, which may incur additional costs. </div>
zh-cn: the description in Chinese </div>
Type: String
AssociationProperty: 'ALIYUN::ECS::Image::ImageId'
AssociationPropertyMetadata:
RegionId: regionId
password:
Label:
en: Password
zh-cn: the description in Chinese
Type: String
Default: ''
keyPairName:
Label:
en: KeyPairName
zh-cn: the description in Chinese
Type: String
Default: ''
targets:
Type: Json
Label:
en: TargetInstance
zh-cn: the description in Chinese
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: 'ALIYUN::ECS::Instance'
RegionId: regionId
rateControl:
Label:
en: RateControl
zh-cn: the description in Chinese
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: the description in Chinese
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: getInstance
Description:
en: Views the ECS instances
zh-cn: the description in Chinese
Action: 'ACS::SelectTargets'
Properties:
ResourceType: 'ALIYUN::ECS::Instance'
RegionId: '{{ regionId }}'
Filters:
- '{{ targets }}'
Outputs:
instanceIds:
Type: List
ValueSelector: 'Instances.Instance[].InstanceId'
- Name: replaceSystemDisk
Action: 'ACS::ECS::ReplaceSystemDisk'
Description:
en: Replaces the system disk of ECS instances
zh-cn: the description in Chinese
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ ACS::TaskLoopItem }}'
imageId: '{{ imageId }}'
keyPairName: '{{ keyPairName }}'
password: '{{ password }}'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ getInstance.instanceIds }}'
Outputs:
newSystemDiskIds:
AggregateType: 'Fn::ListJoin'
AggregateField: newSystemDiskId
Outputs:
newSystemDiskId:
Type: String
ValueSelector: newSystemDiskId
Outputs:
newSystemDiskIds:
Type: String
Value: '{{ replaceSystemDisk.newSystemDiskIds }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- imageId
- password
- keyPairName
Label:
default:
zh-cn: the description in Chinese
en: Configure Parameters
- Parameters:
- regionId
- targets
Label:
default:
zh-cn: the description in Chinese
en: Select ECS Instances
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
zh-cn: the description in Chinese
en: Control Options