模板名稱
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 }}'