All Products
Search
Document Center

Simple Application Server:CreateCommand

Last Updated:Oct 26, 2026

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. You can call ListRegions to query available regions.

cn-hangzhou

Name

string

Yes

The name of the command. All characters are supported. The name cannot exceed 128 characters in length.

testName

Description

string

No

The description of the command. All characters are supported. The description cannot exceed 512 characters in length.

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. Take note of the following items:

  • If you set the EnableParameter parameter to true, you can use custom parameters in the command content.

  • Custom parameters are enclosed in braces ({{}}). Spaces and line breaks before and after the parameter names within the braces are ignored.

  • You can specify a maximum of 20 custom parameters.

  • A custom parameter name can contain only letters, digits, hyphens (-), and underscores (_). Parameter names are not case-sensitive.

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

ifconfig -s

WorkingDir

string

No

The directory in which the created command is run on the ECS instance.

Default value:

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

  • 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 running the command on the instance, in seconds.

If the task that runs the command times out, Cloud Assistant forcibly terminates the task process. Valid values: 10 to 86400 (24 hours).

Default value: 60.

60

EnableParameter

boolean

No

Specifies whether the created command uses custom parameters.

Default value: false.

false

Tag

array<object>

No

The list of tags. You can specify up to 20 tags.

object

No

The tag.

Key

string

No

The key of tag N that is added to the command. Valid values of N: 1 to 20.

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

TestKey

Value

string

No

The value of tag N that is added to the command. Valid values of N: 1 to 20.

The tag value can be an empty string. The tag value 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.