Nome do modelo
ACS-ECS-BulkyRunCommand: Envio de comandos remotos
Descrição do modelo
Este modelo executa comandos do Cloud Assistant em lote em várias instâncias do Elastic Compute Service (ECS). Ele é ideal para cenários como gerenciamento de aplicações e aplicação de tags em recursos. Durante a configuração, especifique os parâmetros obrigatórios: ID da região (regionId), tipo de recurso (resourceType) e instâncias de destino (targets). Defina também o tipo de comando (commandType), como Shell ou Python, além do conteúdo do comando (commandContent). Após a execução, o modelo retorna a saída da operação em lote, permitindo que você verifique o status de execução dos comandos.
Tipo de modelo
Automatizado
Proprietário
Alibaba Cloud
Parâmetros de entrada
|
Parâmetro |
Descrição |
Tipo |
Obrigatório |
Valor padrão |
Limite |
|
targets |
Instância de destino |
Json |
Sim |
||
|
commandContent |
Conteúdo do comando. |
String |
Sim |
O comando pode ter até 16.384 bytes. |
|
|
regionId |
ID da região. |
String |
Não |
{{ ACS::RegionId }} |
|
|
resourceType |
Tipo de recurso. |
String |
Não |
ALIYUN::ECS::Instance |
|
|
commandType |
Tipo de comando. |
String |
Não |
RunShellScript |
|
|
workingDir |
Diretório onde o comando é executado. |
String |
Não |
"" |
|
|
timeout |
Tempo limite, em segundos. |
Number |
Não |
600 |
|
|
enableParameter |
Indica se o comando contém parâmetros criptografados ou personalizados. |
Boolean |
Não |
False |
|
|
username |
Nome de usuário da conta usada para executar o comando. |
String |
Não |
"" |
|
|
windowsPasswordName |
Senha da conta usada para executar o comando em instâncias Windows. |
String |
Não |
"" |
|
|
rateControl |
Concorrência de execução da tarefa |
Json |
Não |
{'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} |
|
|
OOSAssumeRole |
Função RAM assumida pelo OOS. |
String |
Não |
"" |
Parâmetros de saída
|
Parâmetro |
Descrição |
Tipo |
|
commandOutputs |
List |
Política de permissões necessária para executar o modelo
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeInstances",
"ecs:DescribeInvocationResults",
"ecs:DescribeInvocations",
"ecs:DescribeManagedInstances",
"ecs:RunCommand"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"oos:GetApplicationGroup"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
Detalhes
Detalhes do ACS-ECS-BulkyRunCommand
Conteúdo do modelo
FormatVersion: OOS-2019-06-01
Description:
en: 'Runs Cloud Assistant commands on multiple Elastic Compute Service (ECS) instances in batches. This template is for scenarios that require managing many ECS instances at once, such as for application management and resource tagging. When you configure the template, you must provide required parameters. These include the region ID (regionId), the resource type (resourceType), and the target instances (targets). You also specify the command type (commandType), such as Shell or Python, and the command content (commandContent). After the template runs, it returns the output of the batch operation. You can use the output to verify the command execution status.'
zh-cn: the description in Chinese
name-en: Run Command
name-zh-cn: the description in Chinese
categories:
- run_command
- application_manage
- computenest
- tag_operate_resource
Parameters:
regionId:
Type: String
Label:
en: Region ID
zh-cn: the description in Chinese
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
resourceType:
Type: String
Label:
en: Resource type
zh-cn: the description in Chinese
AssociationPropertyMetadata:
LocaleKey: TargetResourceType
AllowedValues:
- ALIYUN::ECS::Instance
- ALIYUN::ECS::ManagedInstance
Default: ALIYUN::ECS::Instance
targets:
Type: Json
Label:
en: Target instance
zh-cn: the description in Chinese
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: resourceType
RegionId: regionId
Status: Running
commandType:
Label:
en: Command type
zh-cn: the description in Chinese
AssociationPropertyMetadata:
LocaleKey: ECSCommandType
Type: String
AllowedValues:
- RunShellScript
- RunPythonScript
- RunPerlScript
- RunBatScript
- RunPowerShellScript
Default: RunShellScript
commandContent:
Label:
en: Command content
zh-cn: the description in Chinese
Type: String
MaxLength: 16384
AssociationProperty: ALIYUN::OOS::Command::CommandContent
AssociationPropertyMetadata:
CommandType: ${commandType}
workingDir:
Description:
en: 'For Linux instances, the default is the home directory of the administrator (root), which is /root. For Windows instances, the default is the directory where the Cloud Assistant client process is located, such as C:\Windows\System32. Ensure that the directory you enter is correct.'
zh-cn: the description in Chinese
Label:
en: Working directory
zh-cn: the description in Chinese
Type: String
Default: ''
AssociationPropertyMetadata:
Value:
- Condition:
Fn::Or:
- Fn::Equals:
- ${commandType}
- RunShellScript
- Fn::Equals:
- ${commandType}
- RunPythonScript
- Fn::Equals:
- ${commandType}
- RunPerlScript
Value: /root
- Condition:
Fn::Or:
- Fn::Equals:
- ${commandType}
- RunBatScript
- Fn::Equals:
- ${commandType}
- RunPowerShellScript
Value: C:\\Windows\\System32
timeout:
Label:
en: Timeout (s)
zh-cn: the description in Chinese
Type: Number
Default: 600
enableParameter:
Label:
en: Enable parameter
zh-cn: the description in Chinese
Type: Boolean
Default: false
username:
Description:
en: The username to run the command on the ECS instance. The username can be up to 255 characters long. For Linux instances, the command is run as the root user by default. For Windows instances, the command is run as the System user by default. Ensure that the username you enter is correct. <a href="https://www.alibabacloud.com/help/doc-detail/203771.html" target="_blank">Learn more</a>
zh-cn: the description in Chinese
Label:
en: Username
zh-cn: the description in Chinese
Type: String
Default: ''
windowsPasswordName:
Label:
en: Password name for Windows user
zh-cn: the description in Chinese
Type: String
Default: ''
AssociationProperty: ALIYUN::OOS::SecretParameter::Value
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Or:
- Fn::Equals:
- ${commandType}
- RunBatScript
- Fn::Equals:
- ${commandType}
- RunPowerShellScript
rateControl:
Label:
en: Rate control
zh-cn: the description in Chinese
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Label:
en: RAM role assumed by OOS
zh-cn: the description in Chinese
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: getInstance
Description:
en: Gets ECS instances
zh-cn: the description in Chinese
Action: ACS::SelectTargets
Properties:
ResourceType: '{{ resourceType }}'
RegionId: '{{ regionId }}'
Filters:
- '{{ targets }}'
Outputs:
instanceIds:
Type: List
ValueSelector: Instances.Instance[].InstanceId
- Name: runCommand
Action: ACS::ECS::RunCommand
Description:
en: Runs the Cloud Assistant command
zh-cn: the description in Chinese
Properties:
regionId: '{{ regionId }}'
commandContent: '{{ commandContent }}'
instanceId: '{{ ACS::TaskLoopItem }}'
commandType: '{{ commandType }}'
workingDir: '{{ workingDir }}'
timeout: '{{ timeout }}'
enableParameter: '{{ enableParameter }}'
username: '{{ username }}'
windowsPasswordName: '{{ windowsPasswordName }}'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ getInstance.instanceIds }}'
Outputs:
commandOutputs:
AggregateType: Fn::ListJoin
AggregateField: commandOutput
Outputs:
commandOutput:
Type: String
ValueSelector: invocationOutput
Outputs:
commandOutputs:
Type: List
Value: '{{ runCommand.commandOutputs }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- commandType
- commandContent
- workingDir
- timeout
- enableParameter
- username
- windowsPasswordName
Label:
default:
zh-cn: the description in Chinese
en: Command execution options
- Parameters:
- regionId
- resourceType
- targets
Label:
default:
zh-cn: the description in Chinese
en: Select instances
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
zh-cn: the description in Chinese
en: Advanced options
Instruções
Leia o documento em inglês para compreender o que precisa ser comunicado
Escreva o texto em português do Brasil DO ZERO — esqueça a estrutura das frases em inglês
Preserve toda a formatação markdown, blocos de código, links e imagens exatamente como estão
Tags xref (
<a data-tag="xref" ...>text</a>) — preserve a TAG INTEIRA com todos os atributos na ordem e caixa originais, traduza APENAS o texto visível entre > eAplique todas as regras específicas de idioma rigorosamente
Aplique as regras de stopwords com tolerância zero
Use o modo imperativo em passos numerados e listas de procedimentos
Garanta a consistência terminológica — o mesmo termo deve ter a mesma tradução em todo o documento
Varie os inícios de frase em listas e tabelas — nenhum início deve se repetir mais de 3 vezes
Retorne APENAS o documento markdown em português do Brasil, sem explicações