Template name
ACS-ECS-BulkyRunCommandInSLBDefaultServerGroup: Runs commands in batches on ECS instances in the default server group of an SLB instance.
Description
Runs commands in batches on ECS instances in the default server group of an SLB instance.
Template type
Automation
Owner
Alibaba Cloud
Input parameters
|
Parameter Name |
Description |
Type |
Required |
Default |
Constraints |
|
loadBalancerId |
The ID of the SLB instance. |
String |
Yes |
||
|
commandType |
The type of the Cloud Assistant command. |
String |
No |
RunShellScript |
|
|
commandContent |
The Cloud Assistant command to run on ECS instances. |
String |
No |
echo hello |
|
|
rateControl |
The concurrency rate for task execution. |
Json |
No |
{‘Mode’: ‘Concurrency’, ‘MaxErrors’: 0, ‘Concurrency’: 1} |
|
|
OOSAssumeRole |
The RAM role that OOS assumes. |
String |
No |
"" |
Output parameters
|
Parameter Name |
Description |
Type |
|
commandOutputs |
List |
Permissions required to run this template
{
"Version": "1",
"Statement": [
{
"Action": [
"slb:DescribeLoadBalancerAttribute",
"slb:SetBackendServers"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"ecs:DescribeInvocationResults",
"ecs:DescribeInvocations",
"ecs:RunCommand"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
Details
ACS-ECS-BulkyRunCommandInSLBDefaultServerGroup details
Template content
FormatVersion: OOS-2019-06-01
Description:
en: Runs commands in batches on ECS instances in the default server group of an SLB instance.
name-en: ACS-ECS-BulkyRunCommandInSLBDefaultServerGroup
categories:
- slb_management
Parameters:
loadBalancerId:
Label:
en: SLB instance ID
Type: String
commandType:
Label:
en: Cloud Assistant command type
Type: String
AllowedValues:
- RunBatScript
- RunPowerShellScript
- RunShellScript
Default: RunShellScript
commandContent:
Label:
en: Cloud Assistant command to run on the ECS instances
Type: String
AssociationProperty: Code
Default: echo hello
rateControl:
Label:
en: Task execution concurrency rate
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 1
OOSAssumeRole:
Label:
en: RAM role for OOS to assume
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: describeLoadBalancerAttribute
Action: ACS::ExecuteApi
Description:
en: Retrieves the attributes of the default server group for the SLB instance.
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: Runs the Cloud Assistant command.
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:
en: Configure parameters
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
en: Advanced options