Nama template
ACS-ESS-LifeCycleDownloadOSSFileAndRunCommand – Menggunakan kait siklus hidup untuk mengunduh file OSS ke instans ECS dan mengeksekusi perintah.
Deskripsi template
Gunakan panggilan balik siklus hidup untuk mengunduh objek Object Storage Service (OSS) 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 | Batasan |
bucketName | Nama Bucket OSS. | String | Ya | ||
objectName | Nama objek OSS. | String | Ya | ||
destinationDir | Direktori tujuan untuk menyalin file pada instans | String | Ya | ||
URLExpirationTime | Periode validitas URL unduhan objek OSS. | Angka | Tidak | 6.000 | |
OSSRegion | Wilayah tempat bucket OSS berada. | String | Tidak | {{ ACS::RegionId }} | |
whetherSaveToFile | Menentukan apakah akan menyimpan isi file ke file tertentu. | Boolean | Tidak | True | |
commandContent | Perintah Cloud Assistant yang akan dijalankan pada instance ECS. | String | Tidak | echo hello | |
timeout | Periode timeout untuk menjalankan perintah pada instance ECS. | Angka | Tidak | 600 | |
regionId | ID wilayah. | String | Tidak | ${regionId} | |
instanceIds | ID instance ECS. | Daftar | Tidak | ['${instanceIds}'] | |
lifecycleHookId | ID panggilan balik siklus hidup. | String | Tidak | ${lifecycleHookId} | |
lifecycleActionToken | Token aktivitas penskalaan tertentu yang terkait dengan instance. | String | Tidak | ${lifecycleActionToken} | |
rateControl | Pengaturan kontrol laju. | Json | Tidak | {'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} | |
OOSAssumeRole | Peran Manajemen Akses Sumber Daya (RAM) yang diasumsikan oleh Layanan Orkestrasi CloudOps (OOS). | String | Tidak | OOSServiceRole |
Parameter output
Tidak ada.
Kebijakan yang diperlukan untuk mengeksekusi template
{
"Version": "1",
"Statement": [
{
"Action": [
"oss:GetObject"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"ecs:DescribeInstances",
"ecs:DescribeInvocationResults",
"ecs:DescribeInvocations",
"ecs:RunCommand"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"ess:CompleteLifecycleAction"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
Detail
ACS-ESS-LifeCycleDownloadOSSFileAndRunCommand
Isi Template
FormatVersion: OOS-2019-06-01
Description:
en: Uses a lifecycle hook to download an OSS file to the ECS instance of a specified scaling activity and run a command.
zh-cn: Uses a lifecycle hook to download an OSS file to the ECS instance of a specified scaling activity and run a command.
name-en: ACS-ESS-LifeCycleDownloadOSSFileAndRunCommand
name-zh-cn: Uses a lifecycle hook to download an OSS file to an ECS instance and run a command.
categories:
- elastic_manage
Parameters:
bucketName:
Label:
en: BucketName
zh-cn: The name of the OSS bucket.
Type: String
objectName:
Label:
en: ObjectName
zh-cn: The name of the OSS object.
Type: String
URLExpirationTime:
Label:
en: OSSFileDownloadURLExpirationTime
zh-cn: The expiration time of the OSS file download URL.
Description:
en: The time-to-live (TTL), in seconds, for the download URL of the OSS object.
zh-cn: The time-to-live (TTL), in seconds, for the download URL of the OSS object.
Type: Number
Default: 6000
OSSRegion:
Label:
en: OSSRegion
zh-cn: The region where the OSS bucket is located.
Type: String
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
destinationDir:
Label:
en: DestinationDir
zh-cn: The destination directory on the instance to which the file is copied.
Type: String
whetherSaveToFile:
Label:
en: whetherSaveToFile
zh-cn: Specifies whether to download the content to a specific file.
Type: Boolean
Default: true
commandContent:
Label:
en: CommandContent
zh-cn: The Cloud Assistant command to run on the ECS instance.
Type: String
AssociationProperty: Code
Default: echo hello
timeout:
Label:
en: Timeout
zh-cn: The timeout period for running the command on the ECS instance.
Type: Number
Default: 600
regionId:
Label:
en: RegionId
zh-cn: The region ID.
Description:
en: The ID of the region. Use the default value ${regionId} provided by Auto Scaling.
zh-cn: The ID of the region. Use the default value ${regionId} provided by Auto Scaling.
Type: String
Default: '${regionId}'
instanceIds:
Label:
en: InstanceIds
zh-cn: A list of ECS instance IDs.
Description:
en: A list of ECS instance IDs. Use the default value ["${instanceId}"] provided by Auto Scaling.
zh-cn: A list of ECS instance IDs. Use the default value ["${instanceId}"] provided by Auto Scaling.
Type: List
Default:
- '${instanceIds}'
lifecycleHookId:
Label:
en: LifecycleHookId
zh-cn: The ID of the lifecycle hook.
Description:
en: The ID of the lifecycle hook. Use the default value ${lifecycleHookId} provided by Auto Scaling.
zh-cn: The ID of the lifecycle hook. Use the default value ${lifecycleHookId} provided by Auto Scaling.
Type: String
Default: '${lifecycleHookId}'
lifecycleActionToken:
Label:
en: LifecycleActionToken
zh-cn: The token for the scaling activity that is associated with the instance.
Description:
en: The token for the scaling activity that is associated with the instance. Use the default value ${lifecycleActionToken} provided by Auto Scaling.
zh-cn: The token for the scaling activity that is associated with the instance. Use the default value ${lifecycleActionToken} provided by Auto Scaling.
Type: String
Default: '${lifecycleActionToken}'
rateControl:
Label:
en: RateControl
zh-cn: Rate control.
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: The RAM role that OOS assumes.
Type: String
Default: OOSServiceRole
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: downloadFileAndRunCommand
OnError: CompleteLifecycleActionForAbandon
OnSuccess: CompleteLifecycleActionForContinue
Action: ACS::ECS::DownloadOSSFileAndRunCommand
Description:
en: Downloads a file to the ECS instances and runs a command.
zh-cn: Downloads a file to the ECS instances and runs a command.
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ ACS::TaskLoopItem }}'
bucketName: '{{ bucketName }}'
objectName: '{{ objectName }}'
URLExpirationTime: '{{ URLExpirationTime }}'
OSSRegion: '{{ OSSRegion }}'
destinationDir: '{{ destinationDir }}'
whetherSaveToFile: '{{ whetherSaveToFile }}'
commandContent: '{{ commandContent }}'
timeout: '{{ timeout }}'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ instanceIds }}'
- Name: CompleteLifecycleActionForContinue
Action: 'ACS::ExecuteAPI'
Description:
en: Changes the lifecycle action to Continue.
zh-cn: Changes the lifecycle action to 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: Changes the lifecycle action to Abandon.
zh-cn: Changes the lifecycle action to Abandon.
Properties:
Service: ESS
API: CompleteLifecycleAction
Parameters:
RegionId: '{{ regionId }}'
LifecycleHookId: '{{ lifecycleHookId }}'
LifecycleActionToken: '{{ lifecycleActionToken }}'
LifecycleActionResult: ABANDON