テンプレート名
ACS-ECS-BulkyDownloadFile
テンプレートの説明
一度に複数の Elastic Compute Service(ECS)インスタンスにファイルをアップロードします。これは、アプリケーションのデプロイやデータ同期など、複数の ECS インスタンスにファイルをアップロードする必要があるシナリオに適用されます。このテンプレートを構成する際には、regionId(ECS インスタンスのリージョン)、targets(ECS インスタンス)、sourceType(ファイルのソース)、sourcePath(ファイルのパス)などのパラメーターを指定する必要があります。テンプレートが実行されると、結果が返されます。
テンプレートタイプ
自動化
所有者
Alibaba Cloud
入力パラメーター
パラメーター | 説明 | タイプ | 必須 | デフォルト値 | 制限 |
targets | ファイルをアップロードする ECS インスタンス。 | Json | はい | ||
sourcePath | ファイルのソースパス。 | String | はい | ||
regionId | リージョン ID。 | String | いいえ | {{ ACS::RegionId }} | |
sourceType | ファイルのタイプ。 | String | いいえ | local | |
destinationDir | ファイルを保存するディレクトリ。 | String | いいえ | /root | |
timeout | タイムアウト期間。 | Number | いいえ | 600 | |
fileOwner | ファイル所有者。 | String | いいえ | "" | |
fileGroup | ファイルが属するファイルグループ。 | String | いいえ | "" | |
fileMode | ファイルの権限。 | String | いいえ | "" | |
overwrite | 既存のファイルを上書きするかどうかを指定します。 | Boolean | いいえ | True | |
rateControl | レート制御設定。 | Json | いいえ | {'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} | |
OOSAssumeRole | CloudOps Orchestration Service (OOS) がアシュームする Resource Access Management (RAM) ロール。 | String | いいえ | "" |
出力パラメーター
パラメーター | 説明 | タイプ |
commandOutput | String |
テンプレートを実行するために必要な権限ポリシー
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeInstances",
"ecs:DescribeInvocationResults",
"ecs:DescribeInvocations",
"ecs:RunCommand"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
参照
詳細については、GitHub の ACS-ECS-BulkyDownloadFile.yml をご参照ください。
テンプレートコンテンツ
FormatVersion: OOS-2019-06-01
Description:
en: 'Bulky upload files to multiple Alibaba Cloud ECS instances, applicable to scenarios that require distributing files across multiple instances, such as application deployment and data synchronization. During configuration, users need to provide the following required parameter information: Region ID (regionId), which specifies the region of the target ECS instances where the files will be uploaded, Target Instances (targets), which defines the specific ECS instances to be operated on, Source Type (sourceType), which specifies the source method of the file (e.g., local, OSS, or HTTPS), and Source Path (sourcePath), which is the exact location of the file. Upon execution, the template provides the results of the file upload operation, enabling users to verify the status of the file uploads.'
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