全部產品
Search
文件中心

CloudOps Orchestration Service:ACS-ECS-ScheduleToUpgradeInternetBandwidthNew

更新時間:Sep 06, 2024

模板名稱

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 }}'