Template name
ACS-ECS-BulkyModifyInstanceChargeTypeSpecifiedInstanceTypeFamilies: Bulk-modifies the billing method of instances in specified instance families
Template description
Changes the billing method of multiple Elastic Compute Service (ECS) instances whose instance type belongs to a specific instance family.
Template type
Automated
Owner
Alibaba Cloud
Input parameters
Parameter | Description | Type | Required | Default value | Limit |
targets | The target instances. | Json | Yes | ||
instanceTypeFamilies | The instance families. | List | Yes | ||
regionId | The region ID. | String | No | {{ ACS::RegionId }} | |
instanceChargeType | The new billing method for the instances. | String | No | PostPaid | |
networkChargeType | The new billing method for the network. | String | No | PayByTraffic | |
rateControl | The concurrency ratio for the task execution. | Json | No | {'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} | |
OOSAssumeRole | The Resource Access Management (RAM) role that Operation Orchestration Service (OOS) assumes. | String | No | "" |
Output parameters
None
Permission policy that is required to execute the template
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeInstances",
"ecs:ModifyInstanceChargeType",
"ecs:ModifyInstanceNetworkSpec"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"oos:GetApplicationGroup"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
Details
For more information, see ACS-ECS-BulkyModifyInstanceChargeTypeSpecifiedInstanceTypeFamilies.yml at GitHub.
Template content
FormatVersion: OOS-2019-06-01
Description:
en: >-
Batch modifies the billing method of instances in specified instance
families.
zh-cn: 批量修改指定实例规格族下实例的计费方式
name-en: ACS-ECS-BulkyModifyInstanceChargeTypeSpecifiedInstanceTypeFamilies
name-zh-cn: 批量修改指定实例规格族下实例的计费方式
categories:
- instance_manage
Parameters:
regionId:
Label:
en: Region ID
zh-cn: 地域ID
Type: String
Description:
en: The ID of the region.
zh-cn: 地域ID。
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
targets:
Label:
en: Target Instances
zh-cn: 目标实例
Type: Json
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: 'ALIYUN::ECS::Instance'
RegionId: regionId
instanceChargeType:
Label:
en: Instance Billing Method
zh-cn: 实例计费方式
Description:
en: The target billing method for the instances.
zh-cn: 实例需要修改的目标计费方式。
Type: String
AllowedValues:
- PostPaid
- PrePaid
Default: PostPaid
networkChargeType:
Label:
en: Network Billing Method
zh-cn: 网络计费方式
Description:
en: The target billing method for the network.
zh-cn: 网络需要修改的目标计费方式。
Type: String
AllowedValues:
- PayByBandwidth
- PayByTraffic
Default: PayByTraffic
instanceTypeFamilies:
Label:
en: Instance Families
zh-cn: 实例规格族
Description:
en: >-
The instance families of the instances whose billing method you want to change.
zh-cn: 要修改付费方式的ECS实例对应的实例规格族
Type: List
rateControl:
Label:
en: Rate Control
zh-cn: 任务执行的并发比率
Description:
en: The rate control settings.
zh-cn: 任务执行的并发比率。
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Label:
en: OOS Assume Role
zh-cn: OOS扮演的RAM角色
Description:
en: The RAM role that OOS assumes.
zh-cn: OOS扮演的RAM角色。
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: getInstance
Description:
en: Gets the ECS instances.
zh-cn: 获取ECS实例。
Action: 'ACS::SelectTargets'
Properties:
ResourceType: 'ALIYUN::ECS::Instance'
RegionId: '{{ regionId }}'
Filters:
- '{{ targets }}'
Outputs:
instanceIds:
Type: List
ValueSelector: 'Instances.Instance[].InstanceId'
- Name: modifyInstanceChargeTypeByInstanceTypeFamily
Description:
en: Modifies the billing method of instances in the specified instance families.
zh-cn: 修改指定例规格族下实例的计费方式。
Action: 'ACS::ECS::ModifyInstanceChargeTypeSpecifiedInstanceTypeFamilies'
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ ACS::TaskLoopItem }}'
instanceChargeType: '{{ instanceChargeType }}'
networkChargeType: '{{ networkChargeType }}'
instanceTypeFamilies: '{{ instanceTypeFamilies }}'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ getInstance.instanceIds }}'