Nama template
ACS-ESS-LifeCycleDownloadFileAndRunCommand
Deskripsi template
Gunakan panggilan balik siklus hidup untuk mengunduh file ke instance Elastic Compute Service (ECS) dan menjalankan perintah pada instance ECS.
Tipe template
Otomatis
Pemilik
Alibaba Cloud
Parameter input
Parameter | Deskripsi | Tipe | Diperlukan | Nilai default | Batas |
sourcePath | URL file yang disimpan. | String | Ya | ||
destinationDir | Direktori tempat file diunduh dalam instance ECS. | String | Ya | ||
whetherSaveToFile | Menentukan apakah akan menyimpan konten file ke file tertentu. | Boolean | Tidak | True | |
commandContent | Perintah Cloud Assistant yang akan dijalankan dalam instance ECS. | String | Tidak | echo hello | |
timeout | Periode waktu habis untuk menjalankan perintah pada instance ECS. | Number | Tidak | 600 | |
regionId | ID wilayah. | String | Tidak | ${regionId} | |
instanceIds | ID instance ECS. | List | Tidak | ['${instanceIds}'] | |
lifecycleHookId | ID panggilan balik siklus hidup. | String | Tidak | ${lifecycleHookId} | |
lifecycleActionToken | Token aktivitas penskalaan tertentu yang terkait dengan instance ECS. | String | Tidak | ${lifecycleActionToken} | |
rateControl | Pengaturan kontrol laju. | Json | Tidak | {'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} | |
OOSAssumeRole | Peran RAM yang diasumsikan oleh CloudOps Orchestration Service (OOS). | String | Tidak | OOSServiceRole |
Parameter output
Tidak ada.
Kebijakan izin yang diperlukan untuk mengeksekusi template
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeInstances",
"ecs:DescribeInvocationResults",
"ecs:DescribeInvocations",
"ecs:RunCommand"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"ess:CompleteLifecycleAction"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
Referensi
Untuk informasi lebih lanjut, lihat ACS-ESS-LifeCycleDownloadFileAndRunCommand.yml di GitHub.
Konten Template
FormatVersion: OOS-2019-06-01
Description:
en: Use lifecycleHook to download file and run command in the specified scaling activity instance
name-en: ACS-ESS-LifeCycleDownloadFileAndRunCommand
categories:
- elastic_manage
Parameters:
sourcePath:
Type: String
Label:
en: SourcePath
destinationDir:
Label:
en: DestinationDir
Type: String
whetherSaveToFile:
Label:
en: whetherSaveToFile
Type: Boolean
Default: true
commandContent:
Label:
en: CommandContent
Type: String
AssociationProperty: Code
Default: echo hello
timeout:
Label:
en: Timeout
Type: Number
Default: 600
regionId:
Label:
en: RegionId
Description:
en: The ID of region
Type: String
Default: '${regionId}'
instanceIds:
Label:
en: InstanceIds
Description:
en: The ID list of the ECS instance
Type: List
Default:
- '${instanceIds}'
lifecycleHookId:
Label:
en: LifecycleHookId
Description:
en: The ID of the lifecycle hook
Type: String
Default: '${lifecycleHookId}'
lifecycleActionToken:
Label:
en: LifecycleActionToken
Description:
en: The token that indicates a specific scaling activity associated with an instance
Type: String
Default: '${lifecycleActionToken}'
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: downloadFileAndRunCommand
OnError: CompleteLifecycleActionForAbandon
OnSuccess: CompleteLifecycleActionForContinue
Action: ACS::ESS::DownloadFileAndRunCommand
Description:
en: Downloads file to the ECS instances adn run command
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ ACS::TaskLoopItem }}'
sourceType: https
sourcePath: '{{ sourcePath }}'
destinationDir: '{{ destinationDir }}'
whetherSaveToFile: '{{ whetherSaveToFile }}'
commandContent: '{{ commandContent }}'
timeout: '{{ timeout }}'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ instanceIds }}'
- Name: CompleteLifecycleActionForContinue
Action: 'ACS::ExecuteAPI'
Description:
en: Modify lifecycle action for continue
OnSuccess: 'ACS::END'
Properties:
Service: ESS
API: CompleteLifecycleAction
Parameters:
RegionId: '{{ regionId }}'
LifecycleHookId: '{{ lifecycleHookId }}'
LifecycleActionToken: '{{ lifecycleActionToken }}'
LifecycleActionResult: CONTINUE
- Name: CompleteLifecycleActionForAbandon
Action: 'ACS::ExecuteAPI'
Description:
en: Complete lifecycle action for Abandon
Properties:
Service: ESS
API: CompleteLifecycleAction
Parameters:
RegionId: '{{ regionId }}'
LifecycleHookId: '{{ lifecycleHookId }}'
LifecycleActionToken: '{{ lifecycleActionToken }}'
LifecycleActionResult: ABANDON