Template name
ACS-ECS-BulkyDownloadOSSFileAndRunCommand
Template description
Downloads a file from Object Storage Service (OSS) to multiple Elastic Compute Service (ECS) instances at a time and runs a Cloud Assistant command on the ECS instances.
Template type
Automated
Owner
Alibaba Cloud
Input parameters
Parameter | Description | Type | Required | Default value | Limit |
targets | The ECS instances to which you want to download the file. | Json | Yes | ||
bucketName | The name of the OSS bucket from which you want to download the file. | String | Yes | ||
objectName | The name of the OSS object. | String | Yes | ||
destinationDir | The directory to which the file is downloaded in the ECS instances. | String | Yes | ||
regionId | The region ID. | String | No | {{ ACS::RegionId }} | |
OSSRegion | The region in which the OSS bucket resides. | String | No | {{ ACS::RegionId }} | |
URLExpirationTime | The validity period of the download URL of the OSS object. | Number | No | 6000 | |
whetherSaveToFile | Specifies whether to save the file content to a specific file. | Boolean | No | True | |
commandContent | The Cloud Assistant command to be run on the ECS instances. | String | No | echo hello | |
timeout | The timeout period for running the command on the ECS instances. | Number | No | 600 | |
rateControl | The rate control settings. | Json | No | {'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} | |
OOSAssumeRole | The Resource Access Management (RAM) role that is assumed by CloudOps Orchestration Service (OOS). | String | No | "" |
Output parameters
None
Permission policy that is required to execute the template
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeInstances",
"ecs:DescribeInvocationResults",
"ecs:DescribeInvocations",
"ecs:RunCommand"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"oss:GetObject"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
References
For more information, see ACS-ECS-BulkyDownloadOSSFileAndRunCommand.yml at GitHub.
Template content
FormatVersion: OOS-2019-06-01
Description:
en: Bulky downLoad OSS file to instances and run command
zh-cn: the description in Chinese
name-en: ACS-ECS-BulkyDownloadOSSFileAndRunCommand
name-zh-cn: the description in Chinese
categories:
- instance_manage
Parameters:
regionId:
Type: String
Label:
en: RegionId
zh-cn: the description in Chinese
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
targets:
Label:
en: TargetInstance
zh-cn: the description in Chinese
Type: Json
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: 'ALIYUN::ECS::Instance'
RegionId: regionId
OSSRegion:
Label:
en: OSSRegion
zh-cn: the description in Chinese
Type: String
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
bucketName:
Label:
en: BucketName
zh-cn: the description in Chinese
Type: String
objectName:
Label:
en: ObjectName
zh-cn: the description in Chinese
Type: String
URLExpirationTime:
Label:
en: DownloadURLExpirationTime
zh-cn: the description in Chinese
Type: Number
Default: 6000
destinationDir:
Label:
en: DestinationDir
zh-cn: the description in Chinese
Type: String
whetherSaveToFile:
Label:
en: whetherSaveToFile
zh-cn: the description in Chinese
Type: Boolean
Default: true
commandContent:
Label:
en: CommandContent
zh-cn: the description in Chinese
Type: String
AssociationProperty: Code
Default: echo hello
timeout:
Label:
en: Timeout
zh-cn: the description in Chinese
Type: Number
Default: 600
rateControl:
Label:
en: RateControl
zh-cn: the description in Chinese
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: the description in Chinese
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: getInstance
Description:
en: Views the ECS instances
zh-cn: the description in Chinese
Action: 'ACS::SelectTargets'
Properties:
ResourceType: 'ALIYUN::ECS::Instance'
RegionId: '{{ regionId }}'
Filters:
- '{{ targets }}'
Outputs:
instanceIds:
Type: List
ValueSelector: 'Instances.Instance[].InstanceId'
- Name: downloadOSSFileAndRunCommand
Action: ACS::ECS::DownloadOSSFileAndRunCommand
Description:
en: Download OSS file to the ECS instances and run command
zh-cn: the description in Chinese
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: '{{ getInstance.instanceIds }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- regionId
- targets
Label:
default:
zh-cn: the description in Chinese
en: Select Instances
- Parameters:
- OSSRegion
- bucketName
- objectName
- URLExpirationTime
- whetherSaveToFile
- destinationDir
Label:
default:
zh-cn: the description in Chinese
en: Configure Download File Parameters
- Parameters:
- commandContent
- timeout
Label:
default:
zh-cn: the description in Chinese
en: Configure Run Command Parameters
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
zh-cn: the description in Chinese
en: Control Options