模板名稱
ACS-ECS-ScheduleToUpgradeInternetBandwidthNew 定時升級ECS實例臨時帶寬
模板描述
定時升級ECS實例臨時帶寬
模板類型
自動化
所有者
Alibaba Cloud
輸入參數
參數名稱 | 描述 | 類型 | 是否必填 | 默認值 | 約束 |
targets | 目標實例 | Json | 是 | ||
timerTrigger | 定時類型 | Json | 是 | ||
regionId | 地域ID | String | 否 | {{ ACS::RegionId }} | |
maxBandwidthOut | 公網最大出帶寬 | Number | 否 | 10 | |
durationHour | 帶寬升級持續時間 | Number | 否 | 4 | |
rateControl | 任務執行的并發比率 | Json | 否 | {‘Mode’: ‘Concurrency’, ‘MaxErrors’: 0, ‘Concurrency’: 10} | |
OOSAssumeRole | OOS扮演的RAM角色 | String | 否 | AliyunServiceRoleForOOSBandwidthScheduler |
輸出參數
無
執行此模板需要的權限策略
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeInstances",
"ecs:ModifyInstanceNetworkSpec"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
詳情
ACS-ECS-ScheduleToUpgradeInternetBandwidthNew詳情
模板內容
FormatVersion: OOS-2019-06-01
Description:
en: Schedule to upgrades internet bandwidth for ECS instances
zh-cn: 定時升級ECS實例臨時帶寬
name-en: ACS-ECS-ScheduleToUpgradeInternetBandwidthNew
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
timerTrigger:
Type: Json
Label:
en: TimerTrigger
zh-cn: 定時類型
AssociationProperty: ALIYUN::OOS::Component::TimerTrigger
AssociationPropertyMetadata:
MinuteInterval: 30
maxBandwidthOut:
Label:
en: The maximum public network bandwidth for out-direction
zh-cn: 公網最大出帶寬
Description:
en: 'Unit: Mbit/s, range:0~100'
zh-cn: 單位:Mbit/s, 取值范圍:0~100
Type: Number
MinValue: 0
MaxValue: 100
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: The RAM role to be assumed by OOS
zh-cn: OOS扮演的RAM角色
Type: String
Default: AliyunServiceRoleForOOSBandwidthScheduler
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: timerTrigger
Action: ACS::TimerTrigger
Description:
en: Triggers a task as scheduled by specifying type and expression
zh-cn: 通過指定觸發類型和表達式按計劃觸發任務
Properties:
Type:
Fn::Select:
- type
- '{{timerTrigger}}'
Expression:
Fn::Select:
- expression
- '{{timerTrigger}}'
EndDate:
Fn::Select:
- endDate
- '{{ timerTrigger }}'
TimeZone:
Fn::Select:
- timeZone
- '{{ timerTrigger }}'
- 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 }}'
InternetMaxBandwidthOut: '{{ maxBandwidthOut }}'
EndTime:
Fn::FormatUTCTime:
- Fn::AddHour:
- '{{ ACS::CurrentUTCTime }}'
- '{{ durationHour }}'
- '%Y-%m-%dT%HZ'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ getInstance.instanceIds }}'
文檔內容是否對您有幫助?