All Products
Search
Document Center

CloudOps Orchestration Service:ACS-ECS-BulkyModifyInstanceAutoRenewAttribute

Last Updated:Sep 20, 2024

Template name

ACS-ECS-BulkyModifyInstanceAutoRenewAttribute

Execute Now

Template description

Modifies the auto renewal settings 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

The ECS instances whose auto renewal settings you want to modify.

Json

Yes

duration

The auto renewal period of the ECS instances.

Number

Yes

regionId

The region ID.

String

No

{{ ACS::RegionId }}

periodUnit

The unit of the renewal duration of the ECS instances.

String

No

Month

autoRenew

Specifies whether to enable auto renewal for the ECS instances.

Boolean

No

False

renewalStatus

The auto renewal status of the ECS instances.

String

No

AutoRenewal

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:ModifyInstanceAutoRenewAttribute"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

References

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

Template content

FormatVersion: OOS-2019-06-01
Description:
  en: Bulky modify instance auto renew attribute
  zh-cn: the description in Chinese
  name-en: ACS-ECS-BulkyModifyInstanceAutoRenewAttribute
  name-zh-cn: the description in Chinese
  categories:
    - instance_manage
Parameters:
  regionId:
    Type: String
    Label:
      en: RegionId
      zh-cn: the description in Chinese
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  targets:
    Type: Json
    Label:
      en: TargetInstance
      zh-cn: the description in Chinese
    AssociationProperty: Targets
    AssociationPropertyMetadata:
      ResourceType: 'ALIYUN::ECS::Instance'
      RegionId: regionId
  periodUnit:
    Label:
      en: PeriodUnit
      zh-cn: the description in Chinese
    Type: String
    AllowedValues:
      - Month
      - Week
      - Year
    Default: Month
  duration:
    Description:
      en: >-
        When PeriodUnit is set to Year, valid values of Duration are 1, 2, and 3
        When PeriodUnit is set to Month, valid values of Duration are 1, 2, 3, 6, 12
        When PeriodUnit is set to Week, valid values of Duration are 1, 2, 3, 4
      zh-cn: the description in Chinese
         
         
         
    Label:
      en: Duration
      zh-cn: the description in Chinese
    Type: Number
  autoRenew:
    Label:
      en: AutoRenew
      zh-cn: the description in Chinese
    Type: Boolean
    Default: false
  renewalStatus:
    Description:
      en: >-
        Valid values:
        AutoRenewal: Auto-renewal is enabled for the instance
        Normal: Auto-renewal is disabled for the instance
        NotRenewal: The instance will not be renewed upon expiration. The system no longer sends an expiration reminder, but sends only a non-renewal reminder three days before the expiration date. You can change the value of this parameter from NotRenewal to Normal for an instance, and then manually renew the instance. Alternatively, you can set the RenewalStatus parameter to AutoRenewal
      zh-cn: the description in Chinese
         
         
         
           
    Label:
      en: AutoRenew
      zh-cn: the description in Chinese
    Type: String
    AllowedValues:
      - AutoRenewal
      - Normal
      - NotRenewal
    Default: AutoRenewal
  rateControl:
    Label:
      en: RateControl
      zh-cn: the description in Chinese
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 10
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      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: modifyInstanceAutoRenewAttribute
    Action: 'ACS::ECS::ModifyInstanceAutoRenewAttribute'
    Description:
      en: Modifies instance auto renew attr
      zh-cn: the description in Chinese
    Properties:
      regionId: '{{ regionId }}'
      instanceId: '{{ ACS::TaskLoopItem }}'
      duration: '{{ duration }}'
      periodUnit: '{{ periodUnit }}'
      autoRenew: '{{ autoRenew }}'
      renewalStatus: '{{ renewalStatus }}'
    Loop:
      RateControl: '{{ rateControl }}'
      Items: '{{ getInstance.instanceIds }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - periodUnit
          - duration
          - autoRenew
          - renewalStatus
        Label:
          default:
            zh-cn: the description in Chinese
            en: Configure Parameters
      - Parameters:
          - regionId
          - targets
        Label:
          default:
            zh-cn: the description in Chinese
            en: Select Ecs Instances
      - Parameters:
          - rateControl
          - OOSAssumeRole
        Label:
          default:
            zh-cn: the description in Chinese
            en: Control Options