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
  }
}

Properties

Name Type Required Editable Description Validity
Name String No Yes The name of the command, which supports all character sets. The name can be up to 30 characters in length. None
WorkingDir String No Yes The working directory where the command will run on ECS instances. None
CommandContent String No No

The Base64-encoded content of the command.

When you specify the Type parameter, you must specify this parameter.

The parameter value must be Base64-encoded for transmission, and the size of the script after the Base64 encoding cannot exceed 16 KB.

None
Timeout Integer No Yes

The timeout period that is specified for the command to run on ECS instances. Unit: seconds.

If the command fails to run within the specified period, the command times out and the command process will be forcibly terminated.

Default value: 3600.

None
Type String Yes No

The type of the command.

Valid values:
  • RunBatScript: Bat script for Windows-based instances.
  • RunPowerShellScript: PowerShell script for Windows-based instances.
  • RunShellScript: Shell script for Linux-based instances.
None
Description String No Yes The description of the command, which supports all character sets. The description can be up to 100 characters in length. None

Response parameters

Fn::GetAtt

  • CommandId: the ID of the command.

Examples

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "WorkingDir": {
      "Type": "String",
      "Description": "The path where command will be executed in the instance."
    },
    "CommandContent": {
      "Type": "String",
      "Description": "The content of command. Content requires base64 encoding. Maximum size support 16KB."
    },
    "Type": {
      "Type": "String",
      "Description": "The type of command."
    },
    "Description": {
      "Type": "String",
      "Description": "The description of command."
    },
    "Timeout": {
      "Type": "Number",
      "Description": "Total timeout when the command is executed in the instance. Input the time unit as second. Default is 3600s."
    },
    "Name": {
      "Type": "String",
      "Description": "The name of command."
    }
  },
  "Resources": {
    "Command": {
      "Type": "ALIYUN::ECS::Command",
      "Properties": {
        "WorkingDir": {
          "Ref": "WorkingDir"
        },
        "CommandContent": {
          "Ref": "CommandContent"
        },
        "Type": {
          "Ref": "Type"
        },
        "Description": {
          "Ref": "Description"
        },
        "Timeout": {
          "Ref": "Timeout"
        },
        "Name": {
          "Ref": "Name"
        }
      }
    }
  },
  "Outputs": {
    "CommandId": {
      "Description": "The id of command created.",
      "Value": {
        "Fn::GetAtt": [
          "Command",
          "CommandId"
        ]
      }
    }
  }
}