Template name
ACS-ECS-ScheduleToUpgradeInternetBandwidthNew: Schedules a temporary Internet bandwidth upgrade for an ECS instance.
Template description
Temporarily upgrades the bandwidth for multiple Elastic Compute Service (ECS) instances as scheduled.
Template type
Automated
Owner
Alibaba Cloud
Input parameters
Parameter | Description | Type | Required | Default value | Limit |
targets | Target instance | Json | Yes | ||
timerTrigger | Schedule type | Json | Yes | ||
regionId | The region ID. | String | No | {{ ACS::RegionId }} | |
maxBandwidthOut | The maximum outbound public bandwidth. | Number | No | 10 | |
durationHour | The duration of the bandwidth upgrade, in hours. | Number | No | 4 | |
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 | AliyunServiceRoleForOOSBandwidthScheduler |
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
Details of ACS-ECS-ScheduleToUpgradeInternetBandwidthNew
Template content
FormatVersion: OOS-2019-06-01
Description:
en: Schedules a temporary bandwidth upgrade for ECS instances.
zh-cn: Schedules a temporary bandwidth upgrade for ECS instances.
name-en: ACS-ECS-ScheduleToUpgradeInternetBandwidthNew
name-zh-cn: Schedules a temporary bandwidth upgrade for ECS instances.
categories:
- time_trigger
Parameters:
regionId:
Type: String
Label:
en: The ID of the region.
zh-cn: The ID of the region.
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
targets:
Type: Json
Label:
en: Target instances
zh-cn: Target instances
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: ALIYUN::ECS::Instance
RegionId: regionId
InternetChargeType: PayByBandwidth
ChargeType: PrePaid
timerTrigger:
Type: Json
Label:
en: Timer trigger
zh-cn: Timer trigger type
AssociationProperty: ALIYUN::OOS::Component::TimerTrigger
AssociationPropertyMetadata:
MinuteInterval: 30
maxBandwidthOut:
Label:
en: The maximum outbound public bandwidth.
zh-cn: The maximum outbound public bandwidth.
Description:
en: 'Unit: Mbit/s. Valid values: 0 to 100.'
zh-cn: 'Unit: Mbit/s. Valid values: 0 to 100.'
Type: Number
MinValue: 0
MaxValue: 100
Default: 10
durationHour:
Label:
en: The duration of the bandwidth upgrade, in hours.
zh-cn: The duration of the bandwidth upgrade, in hours.
Type: Number
MinValue: 4
MaxValue: 10000
Default: 4
AssociationProperty: ALIYUN::OOS::Component::BandwidthUpgradeDurationHour
AssociationPropertyMetadata:
TimerTrigger: '${timerTrigger}'
rateControl:
Label:
en: Rate control
zh-cn: The concurrency rate for the task execution.
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: AliyunServiceRoleForOOSBandwidthScheduler
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: timerTrigger
Action: ACS::TimerTrigger
Description:
en: Triggers the task based on the specified schedule.
zh-cn: Triggers the task based on the specified schedule.
Properties:
Type:
Fn::Select:
- type
- '{{timerTrigger}}'
Expression:
Fn::Select:
- expression
- '{{timerTrigger}}'
StartDate:
Fn::Select:
- startDate
- '{{ timerTrigger }}'
EndDate:
Fn::Select:
- endDate
- '{{ timerTrigger }}'
TimeZone:
Fn::Select:
- timeZone
- '{{ timerTrigger }}'
- Name: getInstance
Description:
en: Gets the specified ECS instances.
zh-cn: Gets 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: modifyInstanceNetworkSpec
Action: ACS::ExecuteAPI
Description:
en: Temporarily modifies the bandwidth of the instances.
zh-cn: Temporarily modifies the bandwidth of the instances.
Properties:
Service: ECS
API: ModifyInstanceNetworkSpec
Parameters:
RegionId: '{{ regionId }}'
InstanceId: '{{ ACS::TaskLoopItem }}'
InternetMaxBandwidthOut: '{{ maxBandwidthOut }}'
EndTime:
Fn::FormatUTCTime:
- Fn::AddHour:
- '{{ ACS::CurrentUTCTime }}'
- '{{ durationHour }}'
- '%Y-%m-%dT%HZ'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ getInstance.instanceIds }}'