テンプレート名
ACS-ECS-ScheduleToStartInstances:スケジュールに従って ECS インスタンスを起動
テンプレートの説明
スケジュールに従って Elastic Compute Service (ECS) インスタンスを起動します。このテンプレートを使用して、特定の時間にインスタンスを起動します。たとえば、指定した期間、開発環境またはテスト環境を自動的に起動できます。テンプレートを設定する際は、必須パラメーターを指定する必要があります。リージョン ID (regionId) はインスタンスのリージョンを指定します。cron 式 (cron) はタスクのスケジュールを定義します。ターゲットインスタンス (targets) は起動する ECS インスタンスを指定します。その後、テンプレートはスケジュールに基づいてインスタンスを起動します。
テンプレートタイプ
自動化
所有者
Alibaba Cloud
入力パラメーター
パラメーター | 説明 | タイプ | 必須 | デフォルト値 | 制限 |
endDate | スケジュールされたタスクの終了時間。 | String | はい | ||
targets | ターゲットインスタンス | Json | はい | ||
regionId | リージョン ID。 | String | いいえ | {{ ACS::RegionId }} | |
cron | CRON 式。 | String | いいえ | 0 0 12 ? * * | |
timeZone | タイムゾーン。 | String | いいえ | UTC | |
rateControl | タスク実行の同時実行率 | Json | いいえ | {'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} | |
OOSAssumeRole | CloudOps Orchestration Service (OOS) によって引き受けられる Resource Access Management (RAM) ロール。 | String | いいえ | OOSServiceRole |
出力パラメーター
パラメーター | 説明 | タイプ |
instanceIds | List |
テンプレートを実行するために必要な権限ポリシー
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeInstances",
"ecs:StartInstance"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"oos:GetApplicationGroup"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
詳細
詳細については、「ACS-ECS-ScheduleToStartInstances」をご参照ください。
テンプレートコンテンツ
FormatVersion: OOS-2019-06-01
Description: スケジュールに従って ECS インスタンスを起動します。このテンプレートを使用して、開発環境やテスト環境の自動起動など、特定の時間にインスタンスを起動します。リージョン ID (regionId)、cron 式 (cron)、およびターゲットインスタンス (targets) を指定する必要があります。その後、テンプレートは指定されたインスタンスをスケジュールに従って起動します。
Name: ACS-ECS-ScheduleToStartInstances
Categories:
- time_trigger
Parameters:
regionId:
Type: String
Label: リージョン ID
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
cron:
Description: '詳細については、https://www.alibabacloud.com/help/document_detail/169784.html をご参照ください'
Label: Cron 式
Type: String
AssociationProperty: Cron
Default: 0 0 12 ? * *
endDate:
Description: 'フォーマット:yyyy-MM-ddTHH:mm:ssZ。'
Label: トリガーの終了時間
Type: String
AssociationProperty: DateTime
AssociationPropertyMetadata:
Format: 'YYYY-MM-DDTHH:mm:ssZ'
timeZone:
Label: タイムゾーン
Type: String
AssociationProperty: TimeZone
Default: UTC
targets:
Type: Json
Label: ターゲットインスタンス
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: 'ALIYUN::ECS::Instance'
RegionId: regionId
rateControl:
Label: タスク実行の同時実行率
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Label: OOS によって偽装される RAM ロール
Type: String
Default: OOSServiceRole
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: timerTrigger
Action: ACS::TimerTrigger
Description: トリガーのタイプと式を指定して、スケジュールに従ってタスクをトリガーします。
Properties:
Type: cron
Expression: '{{ cron }}'
EndDate: '{{ endDate }}'
TimeZone: '{{ timeZone }}'
- Name: getInstance
Description: ECS インスタンスを取得します。
Action: ACS::SelectTargets
Properties:
ResourceType: ALIYUN::ECS::Instance
RegionId: '{{ regionId }}'
Filters:
- '{{ targets }}'
Outputs:
instanceIds:
Type: List
ValueSelector: Instances.Instance[].InstanceId
- Name: startInstance
Action: ACS::ECS::StartInstance
Description: ECS インスタンスを起動します。
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ ACS::TaskLoopItem }}'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ getInstance.instanceIds }}'
Outputs:
instanceIds:
Type: List
Value: '{{ getInstance.instanceIds }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- timeZone
- cron
- endDate
Label:
default:
zh-cn: タイマー設定
en: タイマー設定
- Parameters:
- regionId
- targets
Label:
default:
zh-cn: インスタンスの選択
en: ECS インスタンスの選択
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
zh-cn: 詳細オプション
en: 詳細オプション