Nama Template
ACS-ECS-ScheduleToStopInstances: Hentikan instans ECS sesuai jadwal
Deskripsi Template
Template ini menghentikan instans Elastic Compute Service (ECS) sesuai jadwal. Anda dapat menggunakannya untuk mematikan secara otomatis lingkungan pengembangan atau pengujian guna menghemat biaya. Saat mengonfigurasi template, tentukan ID wilayah, ekspresi cron, dan instans target yang diperlukan. Template tersebut kemudian akan menghentikan instans yang ditentukan berdasarkan jadwal yang telah ditetapkan.
Tipe Template
Otomatisasi
Pemilik
Alibaba Cloud
Parameter Input
Nama parameter | Deskripsi | Tipe | Diperlukan | Nilai Default | Batasan |
endDate | Waktu akhir pemicu timer. | String | Ya | ||
targets | Instans target. | Json | Ya | ||
regionId | ID wilayah. | String | Tidak | {{ ACS::RegionId }} | |
cron | Ekspresi cron. | String | Tidak | 0 0 12 ? * * | |
timeZone | Zona waktu. | String | Tidak | UTC | |
rateControl | Laju konkurensi untuk eksekusi tugas. | Json | Tidak | {'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} | |
OOSAssumeRole | Peran Resource Access Management (RAM) yang diasumsikan oleh Operation Orchestration Service (OOS). | String | Tidak | OOSServiceRole |
Parameter Output
Nama parameter | Deskripsi | Tipe |
instanceIds | List |
Izin yang diperlukan
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeInstances",
"ecs:StopInstance"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"oos:GetApplicationGroup"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
Rincian
Untuk informasi selengkapnya, lihat detail ACS-ECS-ScheduleToStopInstances.
Konten Template
FormatVersion: OOS-2019-06-01
Description:
en: 'Schedule to stop the ECS instances, applicable to scenarios where ECS instances need to be stopped at scheduled times, such as automatically stopping development or test environments to save costs. During configuration, users need to provide the following required parameter information: Region ID (regionId), which specifies the region of the ECS instances to be operated on, Cron Expression (cron), which defines the schedule for the task, and Target Instances (targets), which defines the specific ECS instances to be operated on. Upon execution, the template will stop the ECS instances according to the configured schedule.'
name-en: ACS-ECS-ScheduleToStopInstances
categories:
- time_trigger
Parameters:
regionId:
Type: String
Label:
en: RegionId
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
cron:
Description:
en: 'For more information, see https://www.alibabacloud.com/help/document_detail/169784.html'
Label:
en: CronExpression
Type: String
AssociationProperty: Cron
Default: 0 0 12 ? * *
endDate:
Description:
en: 'Format: yyyy-MM-ddTHH:mm:ssZ.'
Label:
en: EndDate
Type: String
AssociationProperty: DateTime
AssociationPropertyMetadata:
Format: 'YYYY-MM-DDTHH:mm:ssZ'
timeZone:
Label:
en: TimeZone
Type: String
AssociationProperty: TimeZone
Default: UTC
targets:
Type: Json
Label:
en: TargetInstance
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: 'ALIYUN::ECS::Instance'
RegionId: regionId
rateControl:
Label:
en: RateControl
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Label:
en: OOSAssumeRole
Type: String
Default: OOSServiceRole
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: timerTrigger
Action: ACS::TimerTrigger
Description:
en: Triggers a task as scheduled by specifying type and expression
Properties:
Type: cron
Expression: '{{ cron }}'
EndDate: '{{ endDate }}'
TimeZone: '{{ timeZone }}'
- Name: getInstance
Description:
en: Views the ECS instances
Action: ACS::SelectTargets
Properties:
ResourceType: ALIYUN::ECS::Instance
RegionId: '{{ regionId }}'
Filters:
- '{{ targets }}'
Outputs:
instanceIds:
Type: List
ValueSelector: Instances.Instance[].InstanceId
- Name: stopInstance
Action: ACS::ECS::StopInstance
Description:
en: Stops the ECS instances
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:
en: Timer Trigger Configure
- Parameters:
- regionId
- targets
Label:
default:
en: Select ECS Instances
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
en: Control Options