テンプレート名
ACS-ECS-BulkyRunCommandInSLBDefaultServerGroup
テンプレートの説明
Server Load Balancer (SLB) インスタンスのデフォルトサーバーグループにある複数の Elastic Compute Service (ECS) インスタンスで、一度にコマンドを実行します。
テンプレートタイプ
自動化
所有者
Alibaba Cloud
入力パラメーター
パラメーター | 説明 | タイプ | 必須 | デフォルト値 | 制限 |
loadBalancerId | SLB インスタンスの ID です。 | String | はい | ||
commandType | クラウドアシスタントコマンドのタイプです。 | String | いいえ | RunShellScript | |
commandContent | ECS インスタンスで実行されるクラウドアシスタントコマンドです。 | String | いいえ | echo hello | |
rateControl | レート制御設定です。 | Json | いいえ | {'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 1} | |
OOSAssumeRole | CloudOps Orchestration Service (OOS) によってアシュームされる Resource Access Management (RAM) ロールです。 | String | いいえ | "" |
出力パラメーター
パラメーター | 説明 | タイプ |
commandOutputs | List |
テンプレートの実行に必要な権限ポリシー
{
"Version": "1",
"Statement": [
{
"Action": [
"slb:DescribeLoadBalancerAttribute",
"slb:SetBackendServers"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"ecs:DescribeInvocationResults",
"ecs:DescribeInvocations",
"ecs:RunCommand"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
参照
詳細については、GitHub の ACS-ECS-BulkyRunCommandInSLBDefaultServerGroup.yml をご参照ください。
テンプレートコンテンツ
FormatVersion: OOS-2019-06-01
Description:
en: Bulky run command on ECS instances of default server group
zh-cn: the description in Chinese
name-en: ACS-ECS-BulkyRunCommandInSLBDefaultServerGroup
name-zh-cn: the description in Chinese
categories:
- slb_management
Parameters:
loadBalancerId:
Label:
en: LoadBalancerId
zh-cn: the description in Chinese
Type: String
commandType:
Label:
en: CommandType
zh-cn: the description in Chinese
Type: String
AllowedValues:
- RunBatScript
- RunPowerShellScript
- RunShellScript
Default: RunShellScript
commandContent:
Label:
en: CommandContent
zh-cn: the description in Chinese
Type: String
AssociationProperty: Code
Default: echo hello
rateControl:
Label:
en: RateControl
zh-cn: the description in Chinese
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 1
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: the description in Chinese
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: describeLoadBalancerAttribute
Action: ACS::ExecuteApi
Description:
en: Views loadbalancer attribute
zh-cn: the description in Chinese
Properties:
Service: SLB
API: DescribeLoadBalancerAttribute
Parameters:
LoadBalancerId: '{{ loadBalancerId }}'
Outputs:
BackendServers:
Type: List
ValueSelector: BackendServers.BackendServer[]
port:
Type: Number
ValueSelector: ListenerPorts.ListenerPort[]
- Name: runCommand
Action: ACS::ECS::ElegantRunCommandInSLBDefaultServerGroup
Description:
en: Execute cloud assistant command
zh-cn: the description in Chinese
Properties:
loadBalancerId: '{{ LoadBalancerId }}'
commandContent: '{{ commandContent }}'
commandType: '{{ commandType }}'
serverId:
'Fn::Select':
- ServerId
- '{{ ACS::TaskLoopItem }}'
weight:
'Fn::Select':
- Weight
- '{{ ACS::TaskLoopItem }}'
type:
'Fn::Select':
- Type
- '{{ ACS::TaskLoopItem }}'
port: '{{ describeLoadBalancerAttribute.port }}'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ describeLoadBalancerAttribute.BackendServers }}'
Outputs:
commandOutputs:
AggregateType: Fn::ListJoin
AggregateField: commandOutput
Outputs:
commandOutput:
Type: String
ValueSelector: commandOutput
Outputs:
commandOutputs:
Type: List
Value: '{{ runCommand.commandOutputs }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- loadBalancerId
- commandType
- commandContent
Label:
default:
zh-cn: the description in Chinese
en: Configure Parameters
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
zh-cn: the description in Chinese
en: Control