Obtains the command output of an instance. The returned command output is encoded in Base64.
Usage notes
- ECS is a virtualized cloud-based service and cannot be connected to display devices. However, Alibaba Cloud caches system command outputs for the last start, restart, or shutdown of ECS instances. You can call the GetInstanceConsoleOutput operation to obtain the command outputs.
- The command outputs of instances that belong to retired instance types cannot be obtained. For more information, see Retired instance types.
- The command outputs of Windows instances cannot be obtained.
Debugging
Request parameters
|
Parameter |
Type |
Required |
Example |
Description |
| Action | String | Yes | GetInstanceConsoleOutput | The operation that you want to perform. Set the value to GetInstanceConsoleOutput. |
| RegionId | String | Yes | cn-hangzhou | The region ID of the instance. You can call the DescribeRegions operation to query the most recent region list. |
| InstanceId | String | Yes | i-bp1c1xhsrac2coiw**** | The ID of the instance. |
| RemoveSymbols | Boolean | No | false | Specifies whether to remove formatting symbols from the returned command output. Valid values:
Default value: false. |
Response parameters
Parameter |
Type |
Example |
Description |
| LastUpdateTime | String | 2018-03-22 10:04:57 | The time when the previous log entry was generated in the Linux kernel. The time follows the ISO 8601 standard in the yyyy-MM-dd HH:mm:ss format. The time is displayed in UTC+8. |
| RequestId | String | 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E | The ID of the request. |
| InstanceId | String | i-bp1c1xhsrac2coiw**** | The ID of the instance. |
| ConsoleOutput | String | V2VsY29tZSB0byBDZW50T1MgCgpDaGVja2luZyBmaWxlc3lzdGVtcwpDaGVja2luZyBhbGwgZmlsZSBzeXN0ZW1zLgpbL3NiaW4vZnNjay5leHQ0ICgxKSAtLSAvXSBmc2NrLmV4dDQgLWEgL2Rldi92ZGExIAovZGV2L3ZkYTE6IGNsZWFuLCAzMjAxNi8yNjIxNDQwIGZpbGVzLCA0NDc5NzQvMTA0ODU1MDQgYmxvY2tzCgpFbnRlcmluZyBub24taW50ZXJhY3RpdmUgc3RhcnR1cApDYWxsaW5nIHRoZSBzeXN0ZW0gYWN0aXZpdHkgZGF0YSBjb2xsZWN0b3IgKHNhZGMpLi4uIAoKQnJpbmdpbmcgdXAgaW50ZXJmYWNlIGV0aDA6ICAKRGV0ZXJtaW5pbmcgSVAgaW5mb3JtYXRpb24gZm9yIGV0aDAuLi4gZG9uZS4KCmFsaXl1bi1zZXJ2aWNlIHN0YXJ0L3J1bm5pbmcsIHByb2Nlc3MgMTczMwpmaW5pc2hlZAoKQ2VudE9TIHJlbGVhc2UgNi44IChGaW5hbCkKS2VybmVsIDIuNi4zMi02OTYuMy4yLmVsNi5pNjg2IG9uIGFuIGk2ODYKCmlaMnplZDk2ZTQ2MmF5cjBxeioqKioqIGxvZ2luOg== | The Base64-encoded command output of the instance. |
Examples
Sample requests
http://ecs-cn-hangzhou.aliyuncs.com/?Action=GetInstanceConsoleOutput
&InstanceId=i-bp1c1xhsrac2coiw****
&RegionId=cn-hangzhou
&<Common request parameters>
Sample success responses
XML format
HTTP/1.1 200 OK
Content-Type:application/xml
<GetInstanceConsoleOutputResponse>
<RequestId>22A1933F-AD02-4560-A6A7-53CF2231D942</RequestId>
<InstanceId>i-bp1c1xhsrac2coiw****</InstanceId>
<LastUpdateTime>2018-03-22 10:04:57</LastUpdateTime>
<ConsoleOutput>V2VsY29tZSB0byBDZW50T1MgCgpDaGVja2luZyBmaWxlc3lzdGVtcwpDaGVja2luZyBhbGwgZmlsZSBzeXN0ZW1zLgpbL3NiaW4vZnNjay5leHQ0ICgxKSAtLSAvXSBmc2NrLmV4dDQgLWEgL2Rldi92ZGExIAovZGV2L3ZkYTE6IGNsZWFuLCAzMjAxNi8yNjIxNDQwIGZpbGVzLCA0NDc5NzQvMTA0ODU1MDQgYmxvY2tzCgpFbnRlcmluZyBub24taW50ZXJhY3RpdmUgc3RhcnR1cApDYWxsaW5nIHRoZSBzeXN0ZW0gYWN0aXZpdHkgZGF0YSBjb2xsZWN0b3IgKHNhZGMpLi4uIAoKQnJpbmdpbmcgdXAgaW50ZXJmYWNlIGV0aDA6ICAKRGV0ZXJtaW5pbmcgSVAgaW5mb3JtYXRpb24gZm9yIGV0aDAuLi4gZG9uZS4KCmFsaXl1bi1zZXJ2aWNlIHN0YXJ0L3J1bm5pbmcsIHByb2Nlc3MgMTczMwpmaW5pc2hlZAoKQ2VudE9TIHJlbGVhc2UgNi44IChGaW5hbCkKS2VybmVsIDIuNi4zMi02OTYuMy4yLmVsNi5pNjg2IG9uIGFuIGk2ODYKCmlaMnplZDk2ZTQ2MmF5cjBxeioqKioqIGxvZ2luOg==</ConsoleOutput>
</GetInstanceConsoleOutputResponse>
JSON format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "22A1933F-AD02-4560-A6A7-53CF2231D942",
"InstanceId" : "i-bp1c1xhsrac2coiw****",
"LastUpdateTime" : "2018-03-22 10:04:57",
"ConsoleOutput" : "V2VsY29tZSB0byBDZW50T1MgCgpDaGVja2luZyBmaWxlc3lzdGVtcwpDaGVja2luZyBhbGwgZmlsZSBzeXN0ZW1zLgpbL3NiaW4vZnNjay5leHQ0ICgxKSAtLSAvXSBmc2NrLmV4dDQgLWEgL2Rldi92ZGExIAovZGV2L3ZkYTE6IGNsZWFuLCAzMjAxNi8yNjIxNDQwIGZpbGVzLCA0NDc5NzQvMTA0ODU1MDQgYmxvY2tzCgpFbnRlcmluZyBub24taW50ZXJhY3RpdmUgc3RhcnR1cApDYWxsaW5nIHRoZSBzeXN0ZW0gYWN0aXZpdHkgZGF0YSBjb2xsZWN0b3IgKHNhZGMpLi4uIAoKQnJpbmdpbmcgdXAgaW50ZXJmYWNlIGV0aDA6ICAKRGV0ZXJtaW5pbmcgSVAgaW5mb3JtYXRpb24gZm9yIGV0aDAuLi4gZG9uZS4KCmFsaXl1bi1zZXJ2aWNlIHN0YXJ0L3J1bm5pbmcsIHByb2Nlc3MgMTczMwpmaW5pc2hlZAoKQ2VudE9TIHJlbGVhc2UgNi44IChGaW5hbCkKS2VybmVsIDIuNi4zMi02OTYuMy4yLmVsNi5pNjg2IG9uIGFuIGk2ODYKCmlaMnplZDk2ZTQ2MmF5cjBxeioqKioqIGxvZ2luOg=="
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
| 400 | MissingParameter | %s | A required parameter is not specified. |
| 404 | InvalidParameter | %s | Invalid parameter value. |
| 405 | IncorrectInstanceStatus | %s | This operation cannot be performed on the instance in the current state. |
| 405 | NotSupported | %s | Your operation is invalid. |
| 429 | Throttling | %s | The request is denied due to throttling. |
For a list of error codes, see Service error codes.