All Products
Search
Document Center

CloudOps Orchestration Service:ACS-ECS-BulkyModifyInstanceNetworkChargeType

Last Updated:Dec 23, 2025

Template name

ACS-ECS-BulkyModifyInstanceNetworkChargeType Batch-modify the network charge type for ECS instances

Execute Now

Template description

Changes the network 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

networkChargeType

The network billing method of the ECS instances.

String

Yes

regionId

The region ID.

String

No

{{ ACS::RegionId }}

maxBandwidthIn

The maximum inbound bandwidth.

String

No

""

maxBandwidthOut

The maximum outbound bandwidth.

String

No

""

rateControl

Task execution concurrency ratio

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:ModifyInstanceNetworkSpec"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "oos:GetApplicationGroup"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

Details

ACS-ECS-BulkyModifyInstanceNetworkChargeType Details

Template content

FormatVersion: OOS-2019-06-01
Description:
  en: Bulk-modify the network billing method for ECS instances
  name-en: ACS-ECS-BulkyModifyInstanceNetworkChargeType
  categories:
    - instance_manage
Parameters:
  regionId:
    Type: String
    Label:
      en: Region ID
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  targets:
    Type: Json
    Label:
      en: Target Instances
    AssociationProperty: Targets
    AssociationPropertyMetadata:
      ResourceType: 'ALIYUN::ECS::Instance'
      RegionId: regionId
  maxBandwidthIn:
    Label:
      en: Maximum inbound public bandwidth
    Type: String
    Default: ""
  maxBandwidthOut:
    Label:
      en: Maximum outbound public bandwidth
    Type: String
    Default: ""
  networkChargeType:
    Label:
      en: Network billing method
    Type: String
    AllowedValues:
      - PayByBandwidth
      - PayByTraffic
  rateControl:
    Label:
      en: Concurrency rate for task execution
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 10
  OOSAssumeRole:
    Label:
      en: The RAM role to be assumed by OOS
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: getInstance
  Description:
    en: Retrieves the specified ECS instances.
  Action: ACS::SelectTargets
  Properties:
    ResourceType: ALIYUN::ECS::Instance
    RegionId: '{{ regionId }}'
    Filters:
      - '{{ targets }}'
  Outputs:
    instanceIds:
      Type: List
      ValueSelector: Instances.Instance[].InstanceId
- Name: modifyInstanceNetworkChargeType
  Action: ACS::ExecuteAPI
  Description:
    en: Modifies the network billing method of the ECS instance.
  Properties:
    Service: ECS
    API: ModifyInstanceNetworkSpec
    Parameters:
      RegionId: '{{ regionId }}'
      InstanceId: '{{ ACS::TaskLoopItem }}'
      NetworkChargeType: '{{ networkChargeType }}'
      InternetMaxBandwidthIn:
        'Fn::If':
          - 'Fn::Equals':
              - ""
              - '{{ maxBandwidthIn }}'
          - Null
          - '{{ maxBandwidthIn }}'
      InternetMaxBandwidthOut:
        'Fn::If':
          - 'Fn::Equals':
              - ""
              - '{{ maxBandwidthOut }}'
          - Null
          - '{{ maxBandwidthOut }}'
  Loop:
    RateControl: '{{ rateControl }}'
    Items: '{{ getInstance.instanceIds }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - maxBandwidthIn
          - maxBandwidthOut
          - networkChargeType
        Label:
          default:
            en: Configure Parameters
      - Parameters:
          - regionId
          - targets
        Label:
          default:
            en: Select ECS Instances
      - Parameters:
          - rateControl
          - OOSAssumeRole
        Label:
          default:
            en: Advanced Options