Template name
ACS-ECS-ScheduleToUpgradeInternetBandwidth: Schedule temporary Internet bandwidth upgrades for ECS instances
Template description
Schedules temporary bandwidth upgrades for multiple ECS instances.
Template type
Automated
Owner
Alibaba Cloud
Input parameters
|
Parameter |
Description |
Type |
Required |
Default value |
Limit |
|
targets |
Target instances |
Json |
Yes |
||
|
regionId |
Region ID. |
String |
No |
{{ ACS::RegionId }} |
|
|
triggerCron |
Bandwidth upgrade schedule. |
String |
No |
0 0 12 ? * * |
|
|
triggerEndDate |
End time for periodic execution. |
String |
No |
2025-12-31T15:59:59Z |
|
|
timeZone |
Time zone for scheduled execution. |
String |
No |
UTC |
|
|
maxBandwidthIn |
Maximum inbound public bandwidth. |
Number |
No |
10 |
|
|
maxBandwidthOut |
Maximum outbound public bandwidth. |
Number |
No |
10 |
|
|
durationHour |
Duration of the bandwidth upgrade. |
Number |
No |
4 |
|
|
rateControl |
Task execution concurrency |
Json |
No |
{'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} |
|
|
OOSAssumeRole |
RAM role assumed by OOS. |
String |
No |
OOSServiceRole |
Output parameters
None
Required permissions
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeInstances",
"ecs:ModifyInstanceNetworkSpec"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"oos:GetApplicationGroup"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
Template source
ACS-ECS-ScheduleToUpgradeInternetBandwidth template on GitHub.
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-ScheduleToUpgradeInternetBandwidth
name-zh-cn: Schedule a temporary bandwidth upgrade for an ECS instance.
categories:
- time_trigger
Parameters:
regionId:
Type: String
Label:
en: The id of region
zh-cn: Region ID
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
targets:
Type: Json
Label:
en: TargetInstance
zh-cn: Target instance
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: ALIYUN::ECS::Instance
RegionId: regionId
InternetChargeType: PayByBandwidth
ChargeType: PrePaid
triggerCron:
Label:
en: 'The schedule of bandwidth upgrade task'
zh-cn: 'Execution cycle of the bandwidth upgrade task'
Type: String
AssociationProperty: Cron
Default: 0 0 12 ? * *
triggerEndDate:
Label:
en: 'The end date of bandwidth upgrade task'
zh-cn: End time of the rule
Type: String
AssociationProperty: DateTime
AssociationPropertyMetadata:
Format: 'YYYY-MM-DDTHH:mm:ssZ'
Default: '2025-12-31T15:59:59Z'
timeZone:
Label:
en: The time zone of schedule
zh-cn: Time zone of the execution cycle
Type: String
AssociationProperty: TimeZone
Default: UTC
maxBandwidthIn:
Label:
en: The maximum public network bandwidth for in-direction
zh-cn: Maximum inbound public bandwidth
Description:
en: 'Unit: Mbit/s (Megabit per second), range: 1~10 when maxBandwidthOut<=10Mbit/s, else 1~maxBandwidthOut'
zh-cn: 'Unit: Mbit/s. Value range: 1 to 10 if the purchased outbound public bandwidth is 10 Mbit/s or less. 1 to the maximum outbound public bandwidth if the purchased outbound public bandwidth is greater than 10 Mbit/s.'
Type: Number
MinValue: 1
Default: 10
maxBandwidthOut:
Label:
en: The maximum public network bandwidth for out-direction
zh-cn: Maximum outbound public bandwidth
Description:
en: <p>Unit: Mbit/s. The value range is 0 to 200. CloudOps Orchestration Service (OOS) does not validate this parameter. <br/><font color='red'>If the value exceeds 200, the upgrade may fail. You can submit a ticket in the ECS console to increase the bandwidth limit, and then use OOS to perform the upgrade. You can also set the bandwidth to a value within the allowed range.</font></p>
zh-cn: <p>Unit: Mbit/s. The value range is 0 to 200. CloudOps Orchestration Service (OOS) does not validate this parameter. <br/><font color='red'>If the value exceeds 200, the upgrade may fail. You can submit a ticket in the ECS console to increase the bandwidth limit, and then use OOS to perform the upgrade. You can also set the bandwidth to a value within the allowed range.</font></p>
Type: Number
MinValue: 0
Default: 10
durationHour:
Label:
en: The number of hours that the bandwidth upgrade lasts
zh-cn: Duration of the bandwidth upgrade
Description:
zh-cn: 'Unit: Hour. The minimum duration is 4 hours. The upgrade can end only on the hour.'
en: 'Unit: Hour. The bandwidth upgrade should last at least 4 hours. Upgrade only ends on the hour'
Type: Number
MinValue: 4
MaxValue: 10000
Default: 4
rateControl:
Label:
en: RateControl
zh-cn: Concurrency rate for task execution
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: The RAM role that OOS assumes
Type: String
Default: OOSServiceRole
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: timerTrigger
Action: ACS::TimerTrigger
Description:
en: Triggers a task as scheduled by specifying Cron expression
zh-cn: Triggers the task at a scheduled time that is specified by a cron expression.
Properties:
Type: cron
Expression: '{{ triggerCron }}'
EndDate: '{{ triggerEndDate }}'
TimeZone: '{{ timeZone }}'
- Name: getInstance
Description:
en: Views the ECS instances
zh-cn: Gets the 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: Modifies the temporary bandwidth of the instances
zh-cn: Modifies the temporary bandwidth of the instances.
Properties:
Service: ECS
API: ModifyInstanceNetworkSpec
Parameters:
RegionId: '{{ regionId }}'
InstanceId: '{{ ACS::TaskLoopItem }}'
InternetMaxBandwidthIn: '{{ maxBandwidthIn }}'
InternetMaxBandwidthOut: '{{ maxBandwidthOut }}'
EndTime:
Fn::FormatUTCTime:
- Fn::AddHour:
- '{{ ACS::CurrentUTCTime }}'
- '{{ durationHour }}'
- '%Y-%m-%dT%HZ'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ getInstance.instanceIds }}'