すべてのプロダクト
Search
ドキュメントセンター

CloudOps Orchestration Service:ACS-ECS-AlarmDiscountOrPriceInScalingGroupExistingInstanceTypes

最終更新日:Jun 23, 2026

テンプレート名

ACS-ECS-AlarmDiscountOrPriceInScalingGroupExistingInstanceTypes - スケーリンググループ内の既存のインスタンスタイプの価格または割引がしきい値を超えた場合にアラートを送信します。

今すぐ実行

テンプレートの説明

スケーリンググループ内の既存のスポットインスタンスの割引と価格をモニタリングし、価格または割引が指定されたしきい値を超えた場合にアラートを送信します。

テンプレートタイプ

自動化

所有者

Alibaba Cloud

入力パラメーター

パラメーター名

説明

タイプ

必須

デフォルト値

制約

scalingGroupId

スケーリンググループの ID です。

List

はい

threshold

価格または割引のしきい値です。

Number

はい

webhook

メッセージを受信する DingTalk チャットボットの Webhook URL です。

String

はい

region

リージョン ID です。

String

いいえ

{{ ACS::RegionId }}

taskType

モニタリングタスクのタイプです。

String

いいえ

Discount

rateControl

タスク実行のレート制御です。

Json

いいえ

{"Mode": "Concurrency", "MaxErrors": 100, "Concurrency": 10}

OOSAssumeRole

OOS が引き受ける RAM ロールです。

String

いいえ

OOSServiceRole

出力パラメーター

パラメーター名

説明

タイプ

allThresholdInfo

List

このテンプレートに必要なアクセスポリシー

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ess:DescribeScalingGroups",
                "ess:DescribeScalingInstances"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "ecs:DescribeInstances",
                "ecs:DescribeSpotPriceHistory"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

詳細

ACS-ECS-AlarmDiscountOrPriceInScalingGroupExistingInstanceTypes の詳細

テンプレートの内容

FormatVersion: OOS-2019-06-01
Description:
  ja: 'スケーリンググループ内の既存のスポットインスタンスの割引と価格をモニタリングし、値が指定されたしきい値を超えた場合にアラート通知を送信します。'
  name-ja: 'スケーリンググループ内の既存のインスタンスタイプの価格または割引がしきい値を超えた場合にアラートを送信します。'
Parameters:
  region:
    Type: String
    Label:
      ja: リージョン ID
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  scalingGroupId:
    Description:
      ja: スケーリンググループ ID
    Label:
      ja: スケーリンググループ ID
    Type: List
  taskType:
    Description:
      ja: 'モニタリングタスクのタイプ。 有効値: Discount (割引をモニタリング) と Price (価格をモニタリング)。'
    Label:
      ja: タスクタイプ
    Type: String
    Default: Discount
    AllowedValues:
      - Discount
      - Price
  threshold:
    Description:
      ja: '価格または割引のしきい値。 割引の場合、値は従量課金価格のパーセンテージを表します。 たとえば、10 はスポット価格が従量課金価格の 10% であることを意味します。 価格の場合は、価格のしきい値を直接入力します。'
    Label:
      ja: 価格/割引のしきい値
    Type: Number
  webhook:
    Description:
      ja: '例:https://oapi.dingtalk.com/robot/send?access_token=bac51db2e39418ec6c2dbb27fd111bc7xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
    Label:
      ja: DingTalk 通知の Webhook URL
    Type: String
  rateControl:
    Label:
      ja: タスク実行のレート制御
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 100
      Concurrency: 10
  OOSAssumeRole:
    Label:
      ja: OOS が引き受ける RAM ロール
    Type: String
    Default: OOSServiceRole
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: describeScalingGroups
    Action: 'ACS::ExecuteAPI'
    Description:
      ja: スケーリンググループをクエリします。
    Properties:
      Service: ESS
      API: DescribeScalingGroups
      Parameters:
        RegionId: '{{ region }}'
        ScalingGroupId1: '{{ ACS::TaskLoopItem }}'
    Outputs:
      scalingGroupInfo:
        Type: String
        ValueSelector: '.ScalingGroups.ScalingGroup[].ScalingGroupId'
    Loop:
      Items: '{{ scalingGroupId }}'
      RateControl: '{{ rateControl }}'
      Outputs:
        scalingGroupInfos:
          AggregateType: 'Fn::ListJoin'
          AggregateField: scalingGroupInfo
  - Name: wetherOutPutPriceInfo
    Action: 'ACS::Choice'
    Description:
      ja: スケーリンググループが存在するかどうかを確認します。
    Properties:
      DefaultTask: scalingGroupMonitorInfos
      Choices:
        - When:
            'Fn::Equals':
              - []
              - 'Fn::MergeList': '{{ describeScalingGroups.scalingGroupInfos }}'
          NextTask: 'ACS::END'
  - Name: scalingGroupMonitorInfos
    Action: 'ACS::ECS::AlarmSpotPriceOrDiscountBySingleScalingGroup'
    Description:
      ja: スケーリンググループ内のインスタンスタイプの割引または価格をモニタリングします。
    Properties:
      regionId: '{{region}}'
      threshold: '{{ threshold }}'
      taskType: '{{ taskType }}'
      scalingGroupId: '{{ ACS::TaskLoopItem }}'
    Outputs:
      monitorInfo:
        Type: String
        ValueSelector: singleMonitorInfo
    Loop:
      Items: '{{ scalingGroupId }}'
      RateControl: '{{ rateControl }}'
      Outputs:
        allMonitorInfo:
          AggregateField: monitorInfo
          AggregateType: 'Fn::ListJoin'
  - Name: wetherNodifyWebhook
    Action: 'ACS::Choice'
    Description:
      ja: アラート通知が必要かどうかを確認します。
    Properties:
      DefaultTask: alarmNotify
      Choices:
        - When:
            'Fn::Equals':
              - []
              - 'Fn::MergeList':
                  - '{{ scalingGroupMonitorInfos.allMonitorInfo }}'
          NextTask: 'ACS::END'
  - Name: alarmNotify
    Action: 'ACS::Notify'
    Description:
      ja: インスタンスの割引またはスポット価格がしきい値を超えた場合にアラート通知を送信します。
    Properties:
      NotifyType: WebHook
      WebHook:
        URI: '{{ webhook }}'
        Headers:
          Content-Type: application/json
        Content:
          msgtype: markdown
          markdown:
            title: モニタリング結果
            text:
              'Fn::Join':
                - ''
                - 'Fn::ListJoin':
                    - |
                      ### アラートのしきい値 (%): {{ threshold }}
                    - 'Fn::Jq':
                        - First
                        - . | join("\n\n")
                        - 'Fn::MergeList':
                            - '{{ scalingGroupMonitorInfos.allMonitorInfo }}'
Outputs:
  allThresholdInfo:
    Type: List
    Value:
        'Fn::Join':
          - ''
          - 'Fn::ListJoin':
              - |
                ### アラートのしきい値 (%): {{ threshold }}
              - 'Fn::Jq':
                  - First
                  - . | join("\n\n")
                  - 'Fn::MergeList':
                      - '{{ scalingGroupMonitorInfos.allMonitorInfo }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - region
          - scalingGroupId
          - taskType
          - threshold
          - webhook
        Label:
          default:
            ja: パラメーターの設定
      - Parameters:
          - rateControl
          - OOSAssumeRole
        Label:
          default:
            ja: 詳細オプション