テンプレート名
ACS-ECS-ScheduleToAcceptInquiredSystemEvent:システムイベント操作を定期的に受け入れ、承認します。
テンプレートの説明
システムイベントのデフォルト操作を受け入れ、スケジュールに従ってデフォルト操作を実行する権限をシステムに付与します。手順:
Elastic Compute Service ( ECS ) インスタンスを停止します。
システムイベントのデフォルト操作を受け入れ、システムにデフォルト操作を実行する権限を付与します。
ECS インスタンスを起動します。
テンプレートの種類
自動化
所有者
Alibaba Cloud
入力パラメーター
パラメーター | 説明 | 種類 | 必須 | デフォルト値 | 制限 |
timerTrigger | スケジュールされたタスクの種類。 | Json | はい | ||
instanceId | ECS インスタンスの ID。 | String | はい | ||
eventId | システムイベントの ID。 | String | はい | ||
regionId | リージョン ID。 | String | いいえ | {{ ACS::RegionId }} | |
OOSAssumeRole | CloudOps Orchestration Service ( OOS ) によって想定される Resource Access Management ( RAM ) ロール。 | String | いいえ | AliyunServiceRoleForOOSSystemEventOperator |
出力パラメーター
なし
テンプレートを実行するために必要な権限ポリシー
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:AcceptInquiredSystemEvent",
"ecs:DescribeInstances",
"ecs:StartInstance",
"ecs:StopInstance"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
詳細
詳細については、GitHub の ACS-ECS-ScheduleToAcceptInquiredSystemEvent.yml をご参照ください。
テンプレートコンテンツ
FormatVersion: OOS-2019-06-01
Description:
en: <p>システムイベントの受け入れをスケジュールし、その実行を承認します。手順は次のとおりです。 <ol><li>ECS インスタンスを停止します。</li><li>問い合わせのあったシステムイベントを受け入れます。</li><li>ECS インスタンスを起動します。</li</ol></p>
zh-cn: <p>Schedules the acceptance of a system event and authorizes its execution. The process is as follows: <ol><li>Stops the ECS instance.</li><li>Accepts the inquired system event.</li><li>Starts the ECS instance.</li</ol></p>
name-en: ACS-ECS-ScheduleToAcceptInquiredSystemEvent
name-zh-cn: Schedules the acceptance of a system event and authorizes its execution.
categories:
- time_trigger
Parameters:
timerTrigger:
Type: Json
Label:
en: タイマートリガー
zh-cn: Timer type
AssociationProperty: ALIYUN::OOS::Component::TimerTrigger
AssociationPropertyMetadata:
MinuteInterval: 30
regionId:
Label:
en: リージョン ID
zh-cn: Region ID
Type: String
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
instanceId:
Label:
en: ECS インスタンス ID
zh-cn: ECS instance ID
Type: String
AssociationProperty: ALIYUN::ECS::Instance::InstanceId
AssociationPropertyMetadata:
RegionId: regionId
eventId:
Label:
en: イベント ID
zh-cn: System event ID
Type: String
OOSAssumeRole:
Label:
en: OOS が偽装する RAM ロール
zh-cn: The RAM role that is assumed by OOS.
Type: String
Default: AliyunServiceRoleForOOSSystemEventOperator
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: timerTrigger
Action: ACS::TimerTrigger
Description:
en: タイプと式を指定して、スケジュールどおりにタスクをトリガーします。
zh-cn: Triggers a task as scheduled by specifying the type and expression.
Properties:
Type:
Fn::Select:
- type
- '{{timerTrigger}}'
Expression:
Fn::Select:
- expression
- '{{timerTrigger}}'
StartDate:
Fn::Select:
- startDate
- '{{ timerTrigger }}'
EndDate:
Fn::Select:
- endDate
- '{{ timerTrigger }}'
TimeZone:
Fn::Select:
- timeZone
- '{{ timerTrigger }}'
- Name: getInstance
Action: ACS::SelectTargets
Description:
en: ECS インスタンスを取得します。
zh-cn: Obtains the ECS instance.
Properties:
ResourceType: ALIYUN::ECS::Instance
RegionId: '{{ regionId }}'
Filters:
- Type: ResourceIds
RegionId: '{{ regionId }}'
ResourceIds:
- '{{ instanceId }}'
Outputs:
instanceId:
Type: String
ValueSelector: Instances.Instance[].InstanceId
status:
Type: String
ValueSelector: Instances.Instance[].Status
- Name: checkForWhetherResourceExist
Action: ACS::Choice
Description:
en: リソースが存在するかどうかを確認します。
zh-cn: Checks whether the resource exists.
Properties:
DefaultTask: stopInstance
Choices:
- When:
Fn::Equals:
- Null
- '{{ getInstance.instanceId }}'
NextTask: ACS::END
- Name: stopInstance
Action: ACS::ECS::StopInstance
Description:
en: ECS インスタンスを停止します。
zh-cn: Stops the ECS instance.
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ getInstance.instanceId }}'
- Name: acceptInquiredSystemEvent
Action: ACS::ExecuteApi
Description:
en: システムイベント操作を受け入れ、承認します。
zh-cn: Accepts and authorizes system event actions.
Properties:
Service: ECS
API: AcceptInquiredSystemEvent
Parameters:
RegionId: '{{ regionId }}'
EventId: '{{ eventId }}'
- Name: startInstance
Action: ACS::ECS::StartInstance
When:
Fn::Equals:
- Running
- '{{ getInstance.status }}'
Description:
en: ECS インスタンスを起動します。
zh-cn: Starts the ECS instance.
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ getInstance.instanceId }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- timerTrigger
Label:
default:
zh-cn: Timer Settings
en: タイマー設定
- Parameters:
- regionId
- instanceId
- eventId
Label:
default:
zh-cn: Select Instance
en: インスタンスの選択
- Parameters:
- OOSAssumeRole
Label:
default:
zh-cn: Advanced Options
en: 詳細オプション