ALIYUN::ECS::Command is used to create a Cloud Assistant command.
Syntax
{
"Type": "ALIYUN::ECS::Command",
"Properties": {
"Name": String,
"WorkingDir": String,
"CommandContent": String,
"Timeout": Integer,
"Type": String,
"Description": String,
"EnableParameter": Boolean
}
}
Properties
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
Name | String | No | Yes | The name of the command. | The name must be 1 to 128 characters in length. All character sets are supported. |
WorkingDir | String | No | Yes | The execution path of the command in the Elastic Compute Service (ECS) instance. |
|
CommandContent | String | No | No | The Base64-encoded content of the command. | The value of this property must be Base64-encoded and cannot exceed 16 KB in size. The command content supports custom parameters. To enable custom parameters, set the EnableParameter property to true.
|
Timeout | Integer | No | Yes | The timeout period that is specified for the command to run on the ECS instance. | If the command fails to run within the specified period due to specific reasons, the command execution times out. In this case, the command process is forcefully terminated by canceling the process ID (PID) of the command. Default value: 60. Unit: seconds. |
Type | String | Yes | No | The type of the command. | Valid values:
|
Description | String | No | Yes | The description of the command. | The description must be 1 to 512 characters in length. All character sets are supported. |
EnableParameter | Boolean | No | No | Specifies whether to use custom parameters in the command. | Default value: false. Valid values:
|
Return values
Fn::GetAtt
CommandId: the ID of the command.
Note For more information about how to run the command, see ALIYUN::ECS::RunCommand.
Examples
JSON
format{ "ROSTemplateFormatVersion": "2015-09-01", "Parameters": { }, "Resources": { "Command": { "Type": "ALIYUN::ECS::Command", "Properties": { "CommandContent": { "Fn::Base64Encode": "#!/bin/bash\necho \"hello\" >> /root/test.sh\n" }, "Type": "RunShellScript", "Name": { "Ref": "ALIYUN::StackName" } } } }, "Outputs": { "CommandId": { "Description": "The id of command created.", "Value": { "Fn::GetAtt": [ "Command", "CommandId" ] } } } }