模板名称
ACS-ECS-ScheduleToUpgradeInternetBandwidth 定时升级ECS实例临时带宽
模板描述
定时升级ECS实例临时带宽
模板类型
自动化
所有者
Alibaba Cloud
输入参数
参数名称 | 描述 | 类型 | 是否必填 | 默认值 | 约束 |
targets | 目标实例 | Json | 是 | ||
regionId | 地域ID | String | 否 | {{ ACS::RegionId }} | |
triggerCron | 带宽升级任务的执行周期 | String | 否 | 0 0 12 ? * * | |
triggerEndDate | 规则结束时间 | String | 否 | 2025-12-31T15:59:59Z | |
timeZone | 执行周期的时区 | String | 否 | UTC | |
maxBandwidthIn | 公网最大入带宽 | Number | 否 | 10 | |
maxBandwidthOut | 公网最大出带宽 | Number | 否 | 10 | |
durationHour | 带宽升级持续时间 | Number | 否 | 4 | |
rateControl | 任务执行的并发比率 | Json | 否 | {‘Mode’: ‘Concurrency’, ‘MaxErrors’: 0, ‘Concurrency’: 10} | |
OOSAssumeRole | OOS扮演的RAM角色 | String | 否 | OOSServiceRole |
输出参数
无
执行此模板需要的权限策略
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeInstances",
"ecs:ModifyInstanceNetworkSpec"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
详情
ACS-ECS-ScheduleToUpgradeInternetBandwidth详情
模板内容
FormatVersion: OOS-2019-06-01
Description:
en: Schedule to upgrades internet bandwidth for ECS instances
zh-cn: 定时升级ECS实例临时带宽
name-en: ACS-ECS-ScheduleToUpgradeInternetBandwidth
name-zh-cn: 定时升级ECS实例临时带宽
categories:
- time_trigger
Parameters:
regionId:
Type: String
Label:
en: The id of region
zh-cn: 地域ID
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
targets:
Type: Json
Label:
en: TargetInstance
zh-cn: 目标实例
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: ALIYUN::ECS::Instance
RegionId: regionId
InternetChargeType: PayByBandwidth
ChargeType: PrePaid
triggerCron:
Label:
en: 'The schedule of bandwidth upgrade task'
zh-cn: '带宽升级任务的执行周期'
Type: String
AssociationProperty: Cron
Default: 0 0 12 ? * *
triggerEndDate:
Label:
en: 'The end date of bandwidth upgrade task'
zh-cn: 规则结束时间
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: 执行周期的时区
Type: String
AssociationProperty: TimeZone
Default: UTC
maxBandwidthIn:
Label:
en: The maximum public network bandwidth for in-direction
zh-cn: 公网最大入带宽
Description:
en: 'Unit: Mbit/s (Megabit per second), range: 1~10 when maxBandwidthOut<=10Mbit/s, else 1~maxBandwidthOut'
zh-cn: '单位:Mbit/s(Megabit per second),取值范围:当所购公网出带宽小于等于10Mbit/s时:1~10。当所购公网出带宽大于10Mbit/s时:1~公网最大出带宽'
Type: Number
MinValue: 1
Default: 10
maxBandwidthOut:
Label:
en: The maximum public network bandwidth for out-direction
zh-cn: 公网最大出带宽
Description:
en: <p>Unit:Mbit/s (Megabit per second), value range: 0~100,OOS does not validate the maxBandwidthOut parameter value. <br/><font color='red'>If the value exceeded the limit of ECS,bandwidth upgrade task will fail, you can submit a ticket to ECS to raise the maximum bandwidth or modify the bandwidth parameter in limit range.</font></p>
zh-cn: <p>单位:Mbit/s(Megabit per second),取值范围:0~100,运维编排不对带宽值入参进行校验。<br/><font color='red'>如果您设置的带宽值超过ECS的限制,带宽临时升级会失败,您可以在ECS控制台提交工单提高带宽峰值,或者将带宽值修改到限制范围内。</font></p>
Type: Number
MinValue: 0
Default: 10
durationHour:
Label:
en: The number of hours that the bandwidth upgrade lasts
zh-cn: 带宽升级持续时间
Description:
zh-cn: '单位:小时。持续时间最少4小时。带宽升级结束时间目前只支持整点时间'
en: 'Unit: Hour. The bandwidth upgrade should last at least 4 hours. Upgrade only ends on the hour'
Type: Number
MinValue: 4
Default: 4
rateControl:
Label:
en: RateControl
zh-cn: 任务执行的并发比率
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: OOS扮演的RAM角色
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: 通过指定Cron表达式按计划触发任务
Properties:
Type: cron
Expression: '{{ triggerCron }}'
EndDate: '{{ triggerEndDate }}'
TimeZone: '{{ timeZone }}'
- Name: getInstance
Description:
en: Views the ECS instances
zh-cn: 获取ECS实例
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: 修改实例的临时带宽
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 }}'