Use the ACS-ECS-BulkyModifyInstanceChargeType public template in CloudOps Orchestration Service (OOS) to change the billing method of multiple Elastic Compute Service (ECS) instances in a single automated execution. You can switch instances from subscription to pay-as-you-go, or from pay-as-you-go to subscription, without modifying each instance individually.
ECS supports two billing methods. For details, see Subscription and Pay-as-you-go.
Prerequisites
Make sure you meet the prerequisites for the billing method change you want to perform:
Subscription to pay-as-you-go: See Change the billing method of an instance from subscription to pay-as-you-go.
Pay-as-you-go to subscription: See Change the billing method of an instance from pay-as-you-go to subscription.
Procedure
Go to the Automated Task > Public Template page in the OOS console.
In the search box, enter ACS-ECS-BulkyModifyInstanceChargeType and click the Search icon. Find the template in the results, and then click Create Execution.
On the Create Task page, configure the required parameters in the Basic Information step, and then click Next Step: Parameter Settings.
In the Parameter Settings step, configure the billing, instance selection, and execution parameters. For details about each parameter, see Parameter reference.
Click Next Step: OK. Review your settings, and then click Create.
On the Task Execution Management page, find the execution you created and check its status: To view detailed progress, click Details in the Actions column to open the execution logs. You can monitor the execution progress and status of each instance in real time.
Running -- The billing method of the specified ECS instances is being changed.
Success -- The billing method change is complete. You can verify the new billing method on the Instance page of the ECS console.
Parameter reference
The following tables describe the parameters you configure when creating the execution.
Billing parameters
Parameter | Description | Default | Required |
InstanceChargeType | The target billing method for the instances. Valid values: |
| Yes |
NetworkChargeType | The billing method for network usage. Valid values: |
| Yes |
Period | The subscription duration. If PeriodUnit is set to |
| Required when InstanceChargeType is |
PeriodUnit | The time unit of the subscription duration. Valid values: |
| Required when InstanceChargeType is |
IncludeDataDisks | Specifies whether to change the billing method of all data disks attached to the instances from pay-as-you-go to subscription. Valid values: |
| Required when InstanceChargeType is |
Instance selection
Parameter | Description | Required |
RegionId | The ID of the region where the target instances are located. | Yes |
TargetInstance | The ECS instances for which you want to change the billing method. | Yes |
Execution options
OOS processes billing changes across instances in parallel. The following optional parameters control how the execution runs.
Parameter | Description | Default | Required |
RateControl | The concurrency settings for the execution. Concurrency controls how many instances are processed at the same time. MaxErrors sets how many failures are allowed before the execution stops. | Mode: Concurrency, MaxErrors: 0, Concurrency: 10 | No |
OOSAssumeRole | The Resource Access Management (RAM) role to be assumed by OOS. |
| No |
Template reference
This procedure uses the ACS-ECS-BulkyModifyInstanceChargeType public template. You can view the full template definition on the template details page in the OOS console.