Template name
ACS-ECS-BulkyDownloadFile
Template description
Uploads a file to multiple Elastic Compute Service (ECS) instances at a time.
Template type
Automated
Owner
Alibaba Cloud
Input parameters
Parameter | Description | Type | Required | Default value | Limit |
targets | The ECS instances to which you want to upload the file. | Json | Yes | ||
sourcePath | The source path of the file. | String | Yes | ||
regionId | The region ID. | String | No | {{ ACS::RegionId }} | |
sourceType | The type of the file. | String | No | local | |
destinationDir | The directory in which the file is stored. | String | No | /root | |
timeout | The timeout period. | Number | No | 600 | |
fileOwner | The file owner. | String | No | "" | |
fileGroup | The file group to which the file belongs. | String | No | "" | |
fileMode | The permissions on the file. | String | No | "" | |
overwrite | Specifies whether to overwrite existing files. | Boolean | No | True | |
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
Parameter | Description | Type |
commandOutput | String |
Permission policy that is required to execute the template
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeInstances",
"ecs:DescribeInvocationResults",
"ecs:DescribeInvocations",
"ecs:RunCommand"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
References
For more information, see ACS-ECS-BulkyDownloadFile.yml at GitHub.
Template content
FormatVersion: OOS-2019-06-01
Description:
en: Bulky upload files to instances
zh-cn: the description in Chinese
name-en: Upload File
name-zh-cn: the description in Chinese
categories:
- instance_manage
- application_manage
- computenest
Parameters:
regionId:
Type: String
Label:
en: RegionId
zh-cn: the description in Chinese
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
targets:
Type: Json
Label:
en: TargetInstance
zh-cn: the description in Chinese
Description:
en: <p class="p">Precautions:</p> <ul class="ul"> <li class="li"><font color='red'>Download via https requires the ECS instance to enable public network access </font></li><li class="li"><font color='red'>Downloading via oss requires an ECS instance to configure a RAM role, <a href='https://www.alibabacloud.com/help/en/operation-orchestration-service/latest/download-multiple-objects-to-an-instance#vOk3w'>Reference Document</a></font></li>
zh-cn: the description in Chinese
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: 'ALIYUN::ECS::Instance'
RegionId: regionId
Status: Running
sourceType:
Type: String
Description:
en: Local uploaded files cannot exceed 500M
zh-cn: the description in Chinese
Label:
en: SourceType
zh-cn: the description in Chinese
AllowedValues:
- local
- oss
- https
Default: local
AssociationPropertyMetadata:
LocaleKey: DownloadFileType
RegionId: ${regionId}
sourcePath:
Type: String
Label:
en: SourcePath
zh-cn: the description in Chinese
AssociationProperty: ALIYUN::OOS::File::FileUrl
AssociationPropertyMetadata:
FileType: ${sourceType}
RegionId: ${regionId}
destinationDir:
Label:
en: DestinationDir
zh-cn: the description in Chinese
Description:
en: The full path of destination directory
zh-cn: the description in Chinese
Type: String
Default: /root
timeout:
Label:
en: Timeout
zh-cn: the description in Chinese
Type: Number
Default: 600
fileOwner:
Label:
en: FileOwner
zh-cn: the description in Chinese
Type: String
Default: ''
fileGroup:
Label:
en: FileGroup
zh-cn: the description in Chinese
Type: String
Default: ''
fileMode:
Label:
en: FileMode
zh-cn: the description in Chinese
Type: String
Default: ''
overwrite:
Label:
en: Overwrite
zh-cn: the description in Chinese
Type: Boolean
Default: true
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: downloadFileToInstances
Action: 'ACS::ECS::DownloadFile'
Description:
en: Downloads file to the ECS instances
zh-cn: the description in Chinese
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ ACS::TaskLoopItem }}'
sourceType: '{{ sourceType }}'
sourcePath: '{{ sourcePath }}'
destinationDir: '{{ destinationDir }}'
timeout: '{{ timeout }}'
fileOwner: '{{ fileOwner }}'
fileGroup: '{{ fileGroup }}'
fileMode: '{{ fileMode }}'
overwrite: '{{ overwrite }}'
Loop:
Items: '{{ getInstance.instanceIds }}'
RateControl: '{{ rateControl }}'
Outputs:
commandOutputs:
AggregateType: 'Fn::ListJoin'
AggregateField: commandOutput
Outputs:
commandOutput:
Type: String
ValueSelector: commandOutput
Outputs:
commandOutput:
Type: String
Value: '{{ downloadFileToInstances.commandOutputs }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- sourceType
- sourcePath
- destinationDir
Label:
default:
zh-cn: the description in Chinese
en: Configure Parameters
- Parameters:
- regionId
- targets
Label:
default:
zh-cn: the description in Chinese
en: Select Instances
- Parameters:
- timeout
- fileOwner
- fileGroup
- fileMode
- overwrite
- rateControl
- OOSAssumeRole
Label:
default:
zh-cn: the description in Chinese
en: Control Options