All Products
Search
Document Center

Simple Application Server:RunCommand

Last Updated:Aug 28, 2026

Runs commands on a simple application server.

Operation description

Command Assistant is an automated O&M tool that lets you run shell, PowerShell, and batch commands on simple application servers from the console, without logging on to the servers.

Before you use Command Assistant:

  • The simple application server must be in the Running state.

  • The Cloud Assistant client is installed on the server. The client is pre-installed by default. If you manually uninstalled it, reinstall it. For more information, see Install the Cloud Assistant Agent.

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:RunCommand

create

*Command

acs:swas-open:{#regionId}:{#accountId}:{#CommandId}

None None

Request parameters

Parameter

Type

Required

Description

Example

CommandContent

string

Yes

The content of the command.

  • If you set EnableParameter to true, the custom parameter feature is enabled in the command content and you can configure custom parameters based on the following rules:

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

  • You can define up to 20 custom parameters.

  • A custom parameter name can contain only letters, digits, underscores (_), and hyphens (-). The name is case-insensitive.

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

ifconfig -s

WorkingDir

string

No

The execution path of the command. You can specify a custom path. Default paths vary by operating system:

  • For Linux servers, the default path is /root of the root user.

  • For Windows servers, the default path is C:\Windows\system32.

/home/

RegionId

string

Yes

The region ID of the simple application server. You can call the ListRegions operation to query the most recent region list.

cn-hangzhou

Timeout

integer

No

The timeout period of the command on the server.

If a command times out, Command Assistant forcibly terminates the process. Valid values: 10 to 86400. Unit: seconds (86400 seconds = 24 hours).

Default value: 60.

60

Type

string

Yes

The language type of the command. Valid values:

  • RunBatScript: batch commands (applicable to Windows servers).

  • RunPowerShellScript: PowerShell commands (applicable to Windows servers).

  • RunShellScript: shell commands (applicable to Linux servers).

RunShellScript

EnableParameter

boolean

No

Whether to enable the custom parameter feature.

Default value: false.

false

Parameters

object

No

The custom parameters in key-value pair format to pass when the command includes custom parameters. For example, if the command content is echo {{name}}, pass {"name":"Jack"} through Parameters. The name parameter is replaced with the value Jack, and the echo Jack command is executed.

You can specify up to 20 custom parameters:

  • The key of a custom parameter can be up to 64 characters in length and cannot be an empty string.

  • The value of a custom parameter can be an empty string.

  • The size of the command (including custom parameters and original command content) after Base64 encoding cannot exceed 16 KB.

  • The custom parameter names specified in Parameters must match the names defined in the command. You can use empty strings for parameters that are not passed in.

Defaults to empty, which disables the custom parameter feature.

{"name":"Jack", "accessKey":"LTAI****************"}

WorkingUser

string

No

The user who runs the command on the server. To reduce security risks, consider running commands as a regular user. Default values:

  • For Linux servers, the default value is root.

  • For Windows servers, the default value is system.

root

WindowsPasswordName

string

No

The name of the password used to run the command on a Windows simple application server.

To run commands on a Windows server as a user other than the default system user, specify both WindowsPasswordName and WorkingUser. The password is stored in plaintext in the CloudOps Orchestration Service (OOS) parameter repository to reduce the risk of password leaks. Only the password name is passed through WindowsPasswordName.

axtSecretPassword

InstanceId

string

Yes

The ID of the simple application server.

ace0706b2ac4454d984295a94213****

Name

string

Yes

The name of the command.

testName

Response elements

Element

Type

Description

Example

object

Schema of Response

RequestId

string

The request ID.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3****

InvokeId

string

The execution ID.

t-hz02p9545t6****

Examples

Success response

JSON format

{
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
  "InvokeId": "t-hz02p9545t6****"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.