テンプレート名
ACS-SMC-BulkyVerifyInstances: Server Migration Center (SMC) でターゲットインスタンスを検証します
テンプレートの説明
Server Migration Center (SMC) を使用してコマンドを実行し、複数のターゲットインスタンスを検証します。
テンプレートタイプ
オートメーション
所有者
Alibaba Cloud
入力パラメーター
|
パラメーター |
説明 |
型 |
必須 |
デフォルト値 |
制約 |
|
targets |
検証するターゲットインスタンス。 |
Json |
はい |
||
|
regionId |
リージョン ID。 |
String |
いいえ |
{{ ACS::RegionId }} |
|
|
commandType |
Cloud Assistant コマンドのタイプ。 |
String |
いいえ |
RunShellScript |
|
|
commandContent |
コマンドコンテンツ。 |
String |
いいえ |
"" |
|
|
timeout |
コマンド実行のタイムアウト (秒単位)。 |
Number |
いいえ |
600 |
|
|
workingDir |
インスタンス上でコマンドを実行する際の作業ディレクトリ。 |
String |
いいえ |
"" |
|
|
rateControl |
同時実行数やエラー許容度などのレート制御設定。 |
Json |
いいえ |
{'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} |
|
|
OOSAssumeRole |
OOS が引き受ける RAM ロール。 |
String |
いいえ |
"" |
出力パラメ-ター
|
パラメーター |
説明 |
型 |
|
instanceCheckResults |
検証済みの各インスタンスからのコマンド出力。 |
List |
必要な権限
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DeleteInstance",
"ecs:DeleteSecurityGroup",
"ecs:DescribeCloudAssistantStatus",
"ecs:DescribeInstances",
"ecs:DescribeInvocationResults",
"ecs:DescribeInvocations",
"ecs:InstallCloudAssistant",
"ecs:RebootInstance",
"ecs:RunCommand"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"oos:GetApplicationGroup"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"vpc:DeleteVSwitch",
"vpc:DeleteVpc",
"vpc:DescribeVSwitches",
"vpc:DescribeVpcs"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
詳細
ACS-SMC-BulkyVerifyInstances の詳細
テンプレートコンテンツ
FormatVersion: OOS-2019-06-01
Description:
en: Verifies multiple instances by running commands.
zh-cn: 通过执行命令验证多个实例。
name-en: ACS-SMC-BulkyVerifyInstances
name-zh-cn: SMC批量验证目标实例
Parameters:
regionId:
Type: String
Label:
en: RegionId
zh-cn: 地域ID
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
targets:
Type: Json
Label:
en: TargetInstance
zh-cn: 目标实例
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: ALIYUN::ECS::Instance
RegionId: regionId
commandType:
Label:
en: CommandType
zh-cn: 命令类型
Type: String
AllowedValues:
- RunBatScript
- RunPowerShellScript
- RunShellScript
Default: RunShellScript
commandContent:
Label:
en: CommandContent
zh-cn: 命令内容
Type: String
AssociationProperty: Code
Default: ''
timeout:
Label:
en: Timeout
zh-cn: 超时时间
Type: Number
Default: 600
workingDir:
Label:
en: WorkingDir
zh-cn: 工作目录
Type: String
Default: ''
rateControl:
Label:
en: RateControl
zh-cn: 速率控制
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: OOS扮演的RAM角色
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: getInstance
Description:
en: Retrieves the target ECS instances.
zh-cn: 获取目标ECS实例。
Action: ACS::SelectTargets
Properties:
ResourceType: ALIYUN::ECS::Instance
RegionId: '{{ regionId }}'
Filters:
- '{{ targets }}'
Outputs:
instanceIds:
Type: List
ValueSelector: Instances.Instance[].InstanceId
- Name: doInstanceCheck
Action: 'ACS::ECS::SMCVerifyInstanceByRunCommand'
Description:
en: Runs a Cloud Assistant command on each instance for verification.
zh-cn: 在每个实例上运行云助手命令进行验证。
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ ACS::TaskLoopItem }}'
commandContent: '{{ commandContent }}'
commandType: '{{ commandType }}'
workingDir: '{{ workingDir }}'
timeout: '{{ timeout }}'
Outputs:
commandOutput:
Type: String
ValueSelector: invocationOutput
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ getInstance.instanceIds }}'
Outputs:
commandOutputs:
AggregateType: 'Fn::ListJoin'
AggregateField: commandOutput
Outputs:
instanceCheckResults:
Type: List
Value: '{{ doInstanceCheck.commandOutputs }}'