Template name
The ACS-ECS-BulkyModifyInstanceAutoRenewAttribute operation modifies the auto-renewal attribute of multiple instances.
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 | Target instance | 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 | Concurrent task execution rate | 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"
},
{
"Action": [
"oos:GetApplicationGroup"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
Details
For more information, see ACS-ECS-BulkyModifyInstanceAutoRenewAttribute.yml at GitHub.
Template content
FormatVersion: OOS-2019-06-01
Description:
en: Modifies the auto-renewal attributes of instances in batches.
zh-cn: Modifies the auto-renewal attributes of instances in batches.
name-en: ACS-ECS-BulkyModifyInstanceAutoRenewAttribute
name-zh-cn: ACS-ECS-BulkyModifyInstanceAutoRenewAttribute
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
periodUnit:
Label:
en: Renewal Period Unit
zh-cn: Renewal Period Unit
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, and 12.
When PeriodUnit is set to Week, valid values of Duration are 1, 2, 3, and 4.
zh-cn: >-
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, and 12.
When PeriodUnit is set to Week, valid values of Duration are 1, 2, 3, and 4.
Label:
en: Renewal Duration
zh-cn: Renewal Duration
Type: Number
autoRenew:
Label:
en: Enable Auto-renewal
zh-cn: Enable Auto-renewal
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: >-
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.
Label:
en: Auto-renewal Status
zh-cn: Auto-renewal Status
Type: String
AllowedValues:
- AutoRenewal
- Normal
- NotRenewal
Default: AutoRenewal
rateControl:
Label:
en: Rate Control
zh-cn: Rate Control
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Label:
en: The RAM role that OOS assumes
zh-cn: The RAM role that OOS assumes
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: getInstance
Description:
en: Retrieves information about the specified ECS instances.
zh-cn: Retrieves information about 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: modifyInstanceAutoRenewAttribute
Action: 'ACS::ECS::ModifyInstanceAutoRenewAttribute'
Description:
en: Modifies the auto-renewal attributes of an instance.
zh-cn: Modifies the auto-renewal attributes of an instance.
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: Configure Parameters
en: Configure Parameters
- Parameters:
- regionId
- targets
Label:
default:
zh-cn: Select ECS Instances
en: Select ECS Instances
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
zh-cn: Advanced Options
en: Advanced Options