All Products
Search
Document Center

Simple Application Server:CreateCommand

Last Updated:Nov 19, 2025

Creates a Cloud Assistant command.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

swas-open:CreateCommand

create

*Command

acs:swas-open:{#regionId}:{#accountId}:command/*

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The region ID. Call ListRegions to query the available regions.

cn-hangzhou

Name

string

Yes

The name of the command. All character sets are supported. The name can be up to 128 characters long.

testName

Description

string

No

The description of the command. All character sets are supported. The description can be up to 512 characters long.

test

Type

string

Yes

The language type of the command. Valid values:

  • RunBatScript: Bat commands for Windows instances.

  • RunPowerShellScript: PowerShell commands for Windows instances.

  • RunShellScript: Shell commands for Linux instances.

RunShellScript

CommandContent

string

Yes

The content of the command. Note the following:

  • Set EnableParameter to `true` to enable custom parameters in the command content.

  • Define custom parameters in the `{{}}` format. Spaces and line feeds before and after parameter names within `{{}}` are ignored.

  • You can define up to 20 custom parameters.

  • Custom parameter names can contain letters, digits, hyphens (-), and underscores (_). The names are case-insensitive.

  • A single custom parameter name cannot exceed 64 bytes in length.

ifconfig -s

WorkingDir

string

No

The directory where the command is run on the ECS instance.

Default values:

  • For Linux instances: The home directory of the `root` user, which is the /root directory.

  • For Windows instances: The directory where the Cloud Assistant client process is located, such as C:\Windows\System32.

/root/

Timeout

integer

No

The timeout period for the command to run on the server instance, in seconds.

When a command task times out, Cloud Assistant forcibly stops the task process. The timeout period must be between 10 and 86,400 seconds (24 hours).

Default value: 60.

60

EnableParameter

boolean

No

Specifies whether to use custom parameters in the command.

Default value: false.

false

Tag

array<object>

No

The tags. You can add up to 20 tags.

object

No

The tag.

Key

string

No

The key of tag N to add to the command. Valid values of N: 1 to 20.

The tag key cannot be an empty string. It can be up to 64 characters in length and cannot start with `aliyun` or `acs:`. It cannot contain `http://` or `https://`.

TestKey

Value

string

No

The value of tag N to add to the command. Valid values of N: 1 to 20.

The tag value can be an empty string. It can be up to 64 characters in length and cannot contain `http://` or `https://`.

TestValue

ResourceGroupId

string

No

The ID of the resource group.

rg-aek2bti7cf7****

Response elements

Element

Type

Description

Example

object

Schema of Response.

RequestId

string

The request ID.

20758A-585D-4A41-A9B2-28DA8F4****

CommandId

string

The command ID.

c-sh02yh0932w****

Examples

Success response

JSON format

{
  "RequestId": "20758A-585D-4A41-A9B2-28DA8F4****",
  "CommandId": "c-sh02yh0932w****"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.