您好,欢迎访问一九零五行业门户网

如何为一台或多台ECS实例触发一条云助手命令

本篇文章给大家带来的内容是关于如何为一台或多台ecs实例触发一条云助手命令,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。
invokecommand
描述
当您使用该接口时,请注意:
在一个阿里云地域下,您每天最多能运行500次云助手命令。
目标实例的网络类型必须是专有网络vpc。
目标实例的状态必须为 运行中(running)。
目标实例必须预先安装 云助手客户端。
执行类型为powershell的命令时,您需要确保目标ecs windows实例已经配置了powershell模块。
对于单次执行(timed=false),只执行一次命令。
对于周期执行(timed=true),云助手将根据参数frequency指定的时间频率定时执行。上次的执行结果不对下一次执行产生任何影响。
周期执行的时间设置基准为utc +08:00,且该时间以实例的系统时间为准,您需要确保您的ecs实例的时间或者时区与您预期的时间一致。
更多关于时区的详情,linux 实例请参阅 修改 ecs linux 实例时区与设置 ntp 服务,windows 实例请参阅 同步 windows 实例的时钟。
您可以选择多台ecs实例,若其中某台实例不满足执行条件时,您需要重新选择。
命令的执行可能会因为目标实例的状态异常、网络异常或云助手客户端异常而出现无法执行的情况,无法执行时不会生成执行信息。
请求参数
返回参数
示例
请求示例
https://ecs.aliyuncs.com/?action=invokecommand&regionid=cn-hangzhou&instanceid.1=i-bp185dy2o3o6nxxxxxxx&instanceid.2=i-bsdn5dy2o845sxxxxxxx&commandid=c-e996287206324975b5fbe1dxxxxxxxxx&timed=true&frequency=0 0-5 14 * * ?&<公共请求参数>
正常返回示例
xml格式
<invokecommandresponse> <requestid>e69ef3cc-94cd-42e7-8926-f133b86387c0</requestid> <invokeid>t-7d2a745b412b4601b2d47f6a768d3a14</invokeid></invokecommandresponse>
json格式
{ "requestid":"e69ef3cc-94cd-42e7-8926-f133b86387c0", "invokeid":"t-7d2a745b412b4601b2d47f6a768d3a14"}
异常返回示例
xml格式
<error> <requestid>e69ef3cc-94cd-42e7-8926-f133b86387c0</requestid> <hostid>ecs.aliyuncs.com</hostid> <code>missingparameter.commandid</code> <message>the input parameter “commandid” that is mandatory for processing this request is not supplied.</message></error>
json格式
{ "requestid": "e69ef3cc-94cd-42e7-8926-f133b86387c0", "hostid": "ecs.aliyuncs.com" "code": "missingparameter.commandid" "message": "the input parameter “commandid” that is mandatory for processing this request is not supplied."}
错误码
以下为本接口特有的错误码。更多错误码,请访问 api 错误中心。
以上就是如何为一台或多台ecs实例触发一条云助手命令的详细内容。
其它类似信息

推荐信息