Template name
ACS-ECS-BulkyModifyInstanceChargeType: Modifies the billing method of multiple instances in a batch.
Template description
Changes the billing method 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 |
targets | Target instance | Json | Yes | ||
regionId | The region ID. | String | No | {{ ACS::RegionId }} | |
instanceChargeType | The new billing method of the ECS instances. | String | No | PostPaid | |
periodUnit | The unit of the renewal duration. | String | No | Month | |
period | The renewal duration. | Number | No | 1 | |
includeDataDisks | Transform the data disk? | Boolean | No | False | |
networkChargeType | The new network billing method. | String | No | PayByTraffic | |
rateControl | Task execution concurrency | 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
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-BulkyModifyInstanceChargeType.yml at GitHub.
Template content
FormatVersion: OOS-2019-06-01
Description:
en: Changes the billing method for multiple instances.
zh-cn: Changes the billing method for multiple instances.
name-en: ACS-ECS-BulkyModifyInstanceChargeType
name-zh-cn: Change the billing method for multiple instances
categories:
- instance_manage
Parameters:
regionId:
Type: String
Label:
en: Region ID
zh-cn: Region ID
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
targets:
Type: Json
Label:
en: Target Instance
zh-cn: Target Instance
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: ALIYUN::ECS::Instance
RegionId: regionId
instanceChargeType:
Label:
en: Target Billing Method for Instance
zh-cn: Target Billing Method for Instance
Type: String
AllowedValues:
- PostPaid
- PrePaid
Default: PostPaid
periodUnit:
Label:
en: Unit of Renewal Duration
zh-cn: Unit of Renewal Duration
Type: String
AllowedValues:
- Week
- Month
Default: Month
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Not:
Fn::Equals:
- ${instanceChargeType}
- PostPaid
period:
Description:
en: The period of the instance.
zh-cn: If PeriodUnit is Week, the valid values of Period are 1 to 4. If PeriodUnit is Month, the valid values of Period are 1 to 12, 24, 36, 48, and 60.
Label:
en: Renewal Duration
zh-cn: Renewal Duration
Type: Number
Default: 1
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Not:
Fn::Equals:
- ${instanceChargeType}
- PostPaid
includeDataDisks:
Description:
en: Specifies whether to change the billing method of all data disks attached to the instance from pay-as-you-go to subscription.
zh-cn: Specifies whether to convert all pay-as-you-go data disks attached to the instance to subscription.
Label:
en: Convert Data Disks
zh-cn: Convert Data Disks
Type: Boolean
Default: false
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Not:
Fn::Equals:
- ${instanceChargeType}
- PostPaid
networkChargeType:
Label:
en: Target Billing Method for Network
zh-cn: Target Billing Method for Network
Type: String
AllowedValues:
- PayByBandwidth
- PayByTraffic
- ''
AssociationPropertyMetadata:
ValueLabelMapping:
PayByBandwidth: Pay-by-bandwidth
PayByTraffic: Pay-by-traffic
'': Do not change the billing method
Default: PayByTraffic
rateControl:
Label:
en: Task Execution Concurrency Rate
zh-cn: Task Execution Concurrency Rate
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Label:
en: RAM Role for OOS to Assume
zh-cn: RAM Role for OOS to Assume
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: getInstance
Description:
en: Gets ECS instances.
zh-cn: Get ECS instances.
Action: ACS::SelectTargets
Properties:
ResourceType: ALIYUN::ECS::Instance
RegionId: '{{ regionId }}'
Filters:
- '{{ targets }}'
- Name: modifyInstanceChargeType
Description:
en: Modifies the instance billing method.
zh-cn: Modify instance billing method.
Action: ACS::ECS::ModifyInstanceChargeType
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ ACS::TaskLoopItem }}'
instanceChargeType: '{{ instanceChargeType }}'
networkChargeType: '{{ networkChargeType }}'
period: '{{ period }}'
periodUnit: '{{ periodUnit }}'
includeDataDisks: '{{ includeDataDisks }}'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ getInstance.Instances.Instance[].InstanceId }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- instanceChargeType
- period
- periodUnit
- includeDataDisks
- networkChargeType
Label:
default:
zh-cn: Billing Method Parameters
en: Billing Method Parameters
- Parameters:
- regionId
- targets
Label:
default:
zh-cn: Select Instances
en: Select ECS Instances
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
zh-cn: Advanced Options
en: Advanced Options