All Products
Search
Document Center

CloudOps Orchestration Service:ACS-ECS-BulkyModifyInstanceChargeTypeSpecifiedInstanceTypeFamilies

Last Updated:Sep 20, 2024

Template name

ACS-ECS-BulkyModifyInstanceChargeTypeSpecifiedInstanceTypeFamilies

Execute Now

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

Json

Yes

instanceTypeFamilies

The instance family to which the instance type of the ECS instances belongs.

List

Yes

regionId

The region ID.

String

No

{{ ACS::RegionId }}

instanceChargeType

The new billing method of the ECS instances.

String

No

PostPaid

networkChargeType

The new network billing method of the ECS instances.

String

No

PayByTraffic

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

None

Permission policy that is required to execute the template

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:DescribeInstances",
                "ecs:ModifyInstanceChargeType",
                "ecs:ModifyInstanceNetworkSpec"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

References

For more information, see ACS-ECS-BulkyModifyInstanceChargeTypeSpecifiedInstanceTypeFamilies.yml at GitHub.

Template content

FormatVersion: OOS-2019-06-01
Description:
  en: >-
    Bulky modify the billing method of instances in a specified instance type
    family.
  zh-cn: the description in Chinese
  name-en: ACS-ECS-BulkyModifyInstanceChargeTypeSpecifiedInstanceTypeFamilies
  name-zh-cn: the description in Chinese
  categories:
    - instance_manage
Parameters:
  regionId:
    Type: String
    Description:
      en: The id of region.
      zh-cn: the description in Chinese 
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  targets:
    Type: Json
    AssociationProperty: Targets
    AssociationPropertyMetadata:
      ResourceType: 'ALIYUN::ECS::Instance'
      RegionId: regionId
  instanceChargeType:
    Description:
      en: The instance ChargeType.
      zh-cn: the description in Chinese 
    Type: String
    AllowedValues:
      - PostPaid
      - PrePaid
    Default: PostPaid
  networkChargeType:
    Description:
      en: The network ChargeType.
      zh-cn: the description in Chinese 
    Type: String
    AllowedValues:
      - PayByBandwidth
      - PayByTraffic
    Default: PayByTraffic
  instanceTypeFamilies:
    Description:
      en: >-
        The instance type family of the ECS instance whose payment method is to
        be modified
      zh-cn: the description in Chinese
    Type: List
  rateControl:
    Description:
      en: Concurrency ratio of task execution.
      zh-cn: the description in Chinese 
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 10
  OOSAssumeRole:
    Description:
      en: The RAM role to be assumed by OOS.
      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: modifyInstanceChargeTypeByInstanceTypeFamily
    Description:
      en: Modify instance charge type by instance type family.
      zh-cn: the description in Chinese 
    Action: 'ACS::ECS::ModifyInstanceChargeTypeSpecifiedInstanceTypeFamilies'
    Properties:
      regionId: '{{ regionId }}'
      instanceId: '{{ ACS::TaskLoopItem }}'
      instanceChargeType: '{{ instanceChargeType }}'
      networkChargeType: '{{ networkChargeType }}'
      instanceTypeFamilies: '{{ instanceTypeFamilies }}'
    Loop:
      RateControl: '{{ rateControl }}'
      Items: '{{ getInstance.instanceIds }}'