Domain name for API request: tat.intl.tencentcloudapi.com.
This API is used to execute a command and returns the execution activity ID (inv-xxxxxxxx) on success. Each execution has one or more execution tasks (invt-xxxxxxxx) and each execution task indicates an execution record on a CVM or Lighthouse instance.
RUNNING status.A maximum of 20 requests can be initiated per second for this API.
The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| Action | Yes | String | Common Params. The value used for this API: RunCommand. |
| Version | Yes | String | Common Params. The value used for this API: 2020-10-28. |
| Region | Yes | String | Common Params. For more information, please see the list of regions supported by the product. |
| Content | Yes | String | Base64-encoded command. The maximum length is 64 KB. |
| InstanceIds.N | Yes | Array of String | Instance ID list for the command to be executed, with a cap of 200. Instance ID can be obtained through the query instance interface of corresponding cloud services. currently supported instance types:. - CVM - Lighthouse -TAT register instance. |
| CommandName | No | String | Command name. The name can be up to 60 bytes, and contain [a-z], [A-Z], [0-9] and [_-.]. |
| Description | No | String | Command description. The maximum length is 120 characters. |
| CommandType | No | String | Command type. currently supports SHELL, POWERSHELL, BAT. default: SHELL. |
| WorkingDirectory | No | String | Command execution path. The default value is /root for SHELL commands and C:\Program Files\qcloud\tat_agent\workdir for POWERSHELL commands. |
| Timeout | No | Integer | Command timeout period. Default value: 60 seconds. Value range: [1, 86400]. |
| SaveCommand | No | Boolean | Whether to save the command. value range:. The default value is false. |
| EnableParameter | No | Boolean | Whether to enable the custom parameter feature. Once created, this value does not offer modification. Valid values:. The default value is false. |
| DefaultParameters | No | String | Enable the custom parameter feature. default value of the custom parameter. field type is json encoded string. for example: {"varA": "222"}. The key is the custom parameter name, and the value is the default. both kv are string-type. This parameter can be set only when the EnableParameter of the command is true. Parameters must not be specified simultaneously DefaultParameters and DefaultParameterConfs.If Parameters is not provided, the default value here will be used to replace. Custom parameters can be up to 20. The custom parameter name must meet the following standard: the number of characters has a cap of 64, and the optional range is [a-zA-Z0-9-_]. |
| DefaultParameterConfs.N | No | Array of DefaultParameterConf | Custom parameter array. if Parameters is not provided, the default value here will be used to replace. up to 20 custom Parameters are allowed. If Parameters is not provided, the default value here will be used to replace. This parameter can be set only when the EnableParameter of the command is true. Parameters must not be specified simultaneously DefaultParameters and DefaultParameterConfs. |
| Parameters | No | String | Custom parameter of Command. field type is json encoded string. for example: {"varA": "222"}. The key is the custom parameter name, and the value is the default. both kv are string-type. This parameter can be set only when the EnableParameter of the command is true. If the parameter value is not provided, DefaultParameters or DefaultParameterConfs will be used. Custom parameters can be up to 20. The custom parameter name must meet the following standard: the number of characters has a cap of 64, and the optional range is [a-zA-Z0-9-_]. |
| Tags.N | No | Array of Tag | The tags of the command. It is available when SaveCommand is True. A maximum of 10 tags are allowed. |
| Username | No | String | The username used to execute the command on the CVM or Lighthouse instance. The principle of least privilege is the best practice for permission management. We recommend you execute TAT commands as a general user. By default, the user root is used to execute commands on Linux and the user System is used on Windows. |
| OutputCOSBucketUrl | No | String | The COS bucket URL for uploading logs. The URL must start with https, such as https://BucketName-123454321.cos.ap-beijing.myqcloud.com. |
| OutputCOSKeyPrefix | No | String | The COS bucket directory where the logs are saved. Check below for the rules of the directory name. 1. It must be a combination of number, letters, and visible characters. Up to 60 characters are allowed. 2. Use a slash (/) to create a subdirectory. 3. ".." can not be used as the folder name. It cannot start with a slash (/), and cannot contain consecutive slashes. |
| Parameter Name | Type | Description |
|---|---|---|
| CommandId | String | Command ID. |
| InvocationId | String | Execution activity ID. |
| RequestId | String | The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. |
POST / HTTP/1.1
Host: tat.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: RunCommand
<Common request parameters>
{
"CommandName": "run-command",
"SaveCommand": false,
"Description": "whoami",
"Content": "d2hvYW1p",
"CommandType": "SHELL",
"WorkingDirectory": "/root/",
"Timeout": 60,
"InstanceIds": [
"ins-zj0f57ew",
"ins-zj0f57ex",
"ins-zj0f57ev"
]
}
{
"Response": {
"RequestId": "f3e3a951-56b1-4042-af23-ba50223a8f60",
"CommandId": "cmd-5oa8jajm",
"InvocationId": "inv-mp6m9vmu"
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
| Error Code | Description |
|---|---|
| FailedOperation.CVMError | Failed to access the CVM. |
| FailedOperation.LighthouseError | Failed to access the Lighthouse instance. |
| InternalError | Internal error. |
| InvalidParameter | Invalid parameter. |
| InvalidParameter.InvalidUsername | Invalid username. |
| InvalidParameter.ParameterNameDuplicated | Duplicate parameter name. |
| InvalidParameterValue | Invalid parameter value. |
| InvalidParameterValue.AgentUnsupportedCommandType | TAT Agent does not support this command type. |
| InvalidParameterValue.CommandContentInvalid | Invalid command content. |
| InvalidParameterValue.CommandNameDuplicated | Duplicate command name. |
| InvalidParameterValue.InconsistentInstance | Inconsistent instance type. |
| InvalidParameterValue.InvalidCommandName | Invalid command name. |
| InvalidParameterValue.InvalidContent | Invalid command. |
| InvalidParameterValue.InvalidInstanceId | Invalid instance ID. |
| InvalidParameterValue.InvalidOutputCOSBucketUrl | Invalid OutputCOSBucketUrl. |
| InvalidParameterValue.InvalidOutputCOSKeyPrefix | Invalid OutputCOSKeyPrefix. |
| InvalidParameterValue.InvalidUsername | Invalid username. |
| InvalidParameterValue.InvalidWorkingDirectory | Invalid command execution path. |
| InvalidParameterValue.LackOfParameterInfo | The custom parameter feature is enabled, but custom parameters are missing. |
| InvalidParameterValue.LimitExceeded | Parameter limit exceeded. |
| InvalidParameterValue.ParameterDisabled | The custom parameter feature is not enabled. |
| InvalidParameterValue.ParameterInvalidJsonFormat | The parameter is not a valid JSON string. |
| InvalidParameterValue.ParameterKeyContainsInvalidChar | The parameter key contains invalid characters. |
| InvalidParameterValue.ParameterKeyDuplicated | Duplicate parameter keys. |
| InvalidParameterValue.ParameterKeyLenExceeded | The parameter key is too long. |
| InvalidParameterValue.ParameterNumberExceeded | Too many parameters. |
| InvalidParameterValue.ParameterValueNotString | The parameter value is not a string. |
| InvalidParameterValue.Range | The parameter value is not in the valid range. |
| InvalidParameterValue.SupportParametersOnlyIfEnableParameter | The custom parameter feature is not enabled. |
| InvalidParameterValue.TooLong | Length limit exceeded. |
| MissingParameter | Missing parameter. |
| OperationDenied | Operation denied. |
| ResourceNotFound.CosBucketNotFoundCode | CosBucket does not exist. |
| ResourceNotFound.InstanceNotFound | The instance does not exist. |
| ResourceNotFound.RoleNotFound | The role does not exist. |
| ResourceUnavailable | Resources are unavailable. |
| ResourceUnavailable.AgentNotInstalled | TAT Agent is not installed. |
| ResourceUnavailable.AgentStatusNotOnline | TAT Agent is offline. |
| ResourceUnavailable.InstanceStateNotRunning | The instance is not running. |
| ResourceUnavailable.LighthouseUnsupportedRegion | Lighthouse is not supported in the region. |
| ResourceUnavailable.UserHasNoQuotaCode | User quota run out. |
| UnauthorizedOperation.AssumeRoleUnauthorized | Role play unauthorized. |
| UnauthorizedOperation.CamAuthFailed | CAM authentication failed. |
| UnauthorizedOperation.InvalidToken | Invalid token. |
| UnauthorizedOperation.MFAExpired | The Multi-factor authentication (MFA) code expired. |
| UnauthorizedOperation.MFANotFound | Multi-factor authentication (MFA) does not exist. |
Feedback