tencent cloud

自动化助手

产品动态
产品简介
产品概述
产品优势
应用场景
访问管理
使用限制
购买指南
快速入门
操作指南
安装自动化助手客户端
免登录执行命令
批量执行命令
查看命令执行状态
故障处理
Windows实例问题诊断及处理
API 文档
History
Introduction
API Category
Making API Requests
Remote Command APIs
Scheduled Execution APIs
Managed Instance APIs
Scenario APIs
Statistics APIs
Data Types
Error Codes
常见问题
联系我们
词汇表
TAT 政策
TAT 隐私协议
TAT 数据处理和安全协议

InvokeCommand

PDF
聚焦模式
字号
最后更新时间: 2026-03-26 22:28:39

1. API Description

Domain name for API request: tat.intl.tencentcloudapi.com.

This API is used to trigger a command on the specified instance and returns the execution activity ID (inv-xxxxxxxx) on success. Each execution activity has one or more execution tasks (invt-xxxxxxxx) and each execution task indicates an execution record on a CVM or Lighthouse instance.

  • If the agent is not installed on the instance or is offline, an error is returned.
  • If the command type is not supported by the agent runtime environment, an error is returned.
  • The specified instance needs to be in a VPC network.
  • The specified instance needs to be in the RUNNING status.
  • Only one type of instances (CVM or Lighthouse) can be specified in a single request.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

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: InvokeCommand.
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.
CommandId Yes String Pending trigger command ID. call the DescribeCommands api to query command details.
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.
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. you can obtain the EnableParameter settings through the DescribeCommands (detailed command information) api.
If the parameter value is not provided, the DefaultParameters or DefaultParameterConfs of Command will be used to replace it.
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-_].
Username No String The username used to execute the command on the CVM or Lighthouse instance.
The principle of the least privilege is the best practice for permission management. We recommend you execute TAT commands as a general user. If this is not specified, the Username of the command is used by default.
WorkingDirectory No String Execution path of the command. The WorkingDirectory of the command is used by default.
Timeout No Integer Command timeout period. Value range: [1, 86400]. The Timeout of the command is used by default.
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.

3. Output Parameters

Parameter Name Type Description
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.

4. Example

Example1 Triggering a command on a Lighthouse instance

Input Example

POST / HTTP/1.1
Host: tat.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: InvokeCommand
<Common request parameters>

{
    "CommandId": "cmd-ffxdx79i",
    "InstanceIds": [
        "lhins-ar5wyn40"
    ]
}

Output Example

{
    "Response": {
        "RequestId": "41417f50-51b5-4c8d-85b7-f6c508cb228f",
        "InvocationId": "inv-8xgjrytm"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

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.
InvalidParameterValue Invalid parameter value.
InvalidParameterValue.AgentUnsupportedCommandType TAT Agent does not support this command type.
InvalidParameterValue.InconsistentInstance Inconsistent instance type.
InvalidParameterValue.InvalidCommandId Invalid CommandId.
InvalidParameterValue.InvalidInstanceId Invalid instance ID.
InvalidParameterValue.InvalidOutputCOSBucketUrl Invalid OutputCOSBucketUrl.
InvalidParameterValue.InvalidOutputCOSKeyPrefix Invalid OutputCOSKeyPrefix.
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.SupportParametersOnlyIfEnableParameter The custom parameter feature is not enabled.
OperationDenied Operation denied.
ResourceNotFound.CommandNotFound The command does not exist.
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.
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.

帮助和支持

本页内容是否解决了您的问题?

填写满意度调查问卷,共创更好文档体验。

文档反馈