All Products
Search
Document Center

Simple Application Server:RunCommand

Last Updated:Sep 21, 2026

Runs a command on a simple application server.

Operation description

Command Assistant is an automated O&M tool designed for simple application servers. You can run commands (Shell, PowerShell, and Bat) on simple application server instances from the console for operations management without having to log on to the instances.

To use Command Assistant, the following conditions must be met:

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

  • Cloud Assistant Agent must be installed. Cloud Assistant Agent is installed on simple application server instances by default. If you manually uninstalled it, reinstall it. For more information, see Install 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 command content. Note the following items:

  • Set EnableParameter=true to enable the custom parameter feature in the command content:

  • Define custom parameters by enclosing them in {{}}. Spaces and line breaks before and after the parameter name within {{}} are ignored.

  • The number of custom parameters cannot exceed 20.

  • Custom parameter names can contain only letters (a-z, A-Z), digits (0-9), hyphens (-), and underscores (_). Other characters are not supported. Parameter names are case-insensitive.

  • A single custom parameter name cannot exceed 64 bytes.

ifconfig -s

WorkingDir

string

No

The custom execution path of the command. Default paths:

  • Linux instances: The default execution path is the /root directory of the root user.

  • Windows instances: The default execution path is the C:\Windows\system32 directory.

/root

RegionId

string

Yes

The region ID. You can call ListRegions to query the latest region list.

cn-hangzhou

Timeout

integer

No

The timeout period for the command to run on the server instance. Unit: seconds.

When a command execution task times out, Command Assistant forcefully terminates the task process. Valid values: 10 to 86400 (24 hours).

Default value: 60.

60

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

EnableParameter

boolean

No

Specifies whether the command contains custom parameters.

Default value: false.

false

Parameters

object

No

The key-value pairs of custom parameters to pass in when the command contains custom parameters. For example, if the command content is echo {{name}}, you can use the Parameters parameter to pass in the key-value pair {"name":"Jack"}. The custom parameter automatically replaces the variable value name, and the actual command that runs is echo Jack.

The number of custom parameters ranges from 0 to 20. Note the following items:

  • Keys cannot be empty strings and can contain up to 64 characters.

  • Values can be empty strings.

  • The set of custom parameter names must be a subset of the parameter set defined when the command was created. For parameters that are not passed in, you can use empty strings as substitutes.

Default value: empty, which indicates that this parameter is unset to disable custom parameters.

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

WorkingUser

string

No

The user that you want to use to run the command on the simple application server instance. We recommend that you use a regular user to run commands to reduce security risks. Default values:

  • root: On Linux instances, commands are run as the root user by default.

  • system: On Windows instances, commands are run as the system user by default.

root

WindowsPasswordName

string

No

The password name of the user that runs the command on a Windows instance.

If you want to run a command as a non-default user (System) on a Windows instance, you must specify both WorkingUser and this parameter. To reduce the risk of password leaks, store the plaintext password in the parameter repository of CloudOps Orchestration Service and pass in only the password name here.

axtSecretPassword

InstanceId

string

Yes

The instance ID of the simple application server.

ace0706b2ac4454d984295a94213****

Name

string

Yes

The name of the command execution.

testName

Response elements

Element

Type

Description

Example

object

Schema of Response

RequestId

string

The request ID.

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

InvokeId

string

The command 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.