Home > Article > Operation and Maintenance > Obtain the system command line output of an instance and return the data after encoding it in Base64
The content this article brings to you is about obtaining the system command line output of an instance and returning the data after encoding in Base64. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you. help.
GetInstanceConsoleOutput
Description
Cloud server ECS is a virtualized cloud service and cannot access display devices. Unable to take screenshot manually. However, we cache the system command line output when the instance was last started, restarted, or shut down. You can call GetInstanceConsoleOutput to obtain it.
Instance specifications that have been discontinued cannot obtain the system command line output.
Windows instances do not currently support obtaining system command line output.
Request parameters
##Return parameters
Example
Request Example
http://ecs-cn-hangzhou.aliyuncs.com/?Action=GetInstanceConsoleOutput &RegionId=cn-shenzhen-finance-1 &InstanceId=i-j5e42sbbthlokka11eci &<公共请求参数>
Normal return example
XML format
<GetInstanceConsoleOutputResponse> <RequestId>22A1933F-AD02-4560-A6A7-53CF2231D942</RequestId> <InstanceId>i-j5e42sbbthlokka11ech</InstanceId> <LastUpdateTime>2018-03-22 10:04:57</LastUpdateTime> <ConsoleOutput>V2VsY29tZSB0byBDZW50T1MgCgpDaGVja2 luZyBmaWxlc3lzdGVtcwpDaGVja2luZyBhbGwgZmlsZSBzeXN0ZW1zL gpbL3NiaW4vZnNjay5leHQ0ICgxKSAtLSAvXSBmc2NrLmV4dDQgLWEgL2Rldi92ZGExIAovZ GV2L3ZkYTE6IGNsZWFuLCAzMj AxNi8yNjIxNDQwIGZpbGVzLCA0NDc5NzQvMTA0ODU1MDQgYmx vY2tzCgpFbnRlcmluZyBub24taW50ZXJhY3RpdmUgc3RhcnR1cApDYWxs aW5nIHRoZSBzeXN0ZW0gYWN0aXZpdHkgZGF0YS Bjb2xsZWN0b3IgKHNhZGMpLi4uIAoKQnJpbmdpbmcgdXAgaW50ZXJmYWNlIGV0aDA6ICAKRGV0ZXJtaW 5pbmcgSVAgaW5mb3JtYXRpb24gZm9yIGV0aDAuLi4gZG9uZS4KCmFsaXl1bi1zZXJ2aWNlIHN0YXJ0L3J1bm 5pbmcsIHByb2Nlc3MgMTczMwpmaW5pc2hlZAoKQ2VudE9TIHJlbGVhc2UgNi44IChGaW5hbCkKS2 VybmVsIDIuNi4zMi02OTYuMy4yLmVsNi5pNjg2IG9uIGFuIGk2ODYKCmlaMnplZDk2ZTQ2Mm F5cjBxemw2czhaIGxvZ2luOg==</ConsoleOutput> </GetInstanceConsoleOutputResponse>
JSON format
{ "RequestId": "22A1933F-AD02-4560-A6A7-53CF2231D942", "InstanceId": "i-j5e42sbbthlokka11ech", "LastUpdateTime": "2018-03-22 10:04:57", "ConsoleOutput": "V2VsY29tZSB0byBDZW50T1MgCgpDaGVja2luZyBmaWxlc3lzdGVtcwpDaGVja2luZyBhbGwgZ mlsZSBzeXN0ZW1zLgpbL3NiaW4vZnNjay5leHQ0ICgxKSAtLSAvXSBmc2NrLmV4dDQgLWEgL2Rldi92ZGExIAovZGV2 L3ZkYTE6IGNsZWFuLCAzMjAxNi8yNjIxNDQwIGZpbGVzLCA0NDc5NzQvMTA0ODU1MD QgYmxvY2tzCgpFbnRlcmluZyBub24taW50ZXJhY3RpdmUgc3RhcnR1cApDYWxsaW5nIHRoZSBzeXN0ZW0gYWN0 aXZpdHkgZGF0YSBjb2xsZWN0b3IgKHNhZGMpLi4uIAoKQnJpbmdpbmcgdXAg aW50ZXJmYWNlIGV0aDA6ICAKRGV0ZXJtaW5pbmcgSVAgaW5mb3JtYXRpb2 4gZm9yIGV0aDAuLi4gZG9uZS4KCmFsaXl1bi1zZXJ2aWNlIHN0YXJ0L3J1bm5 pbmcsIHByb2Nlc3MgMTczMwpmaW5pc2hlZAoKQ2VudE9TIHJlbGVhc2UgNi44IChG aW5hbCkKS2VybmVsIDIuNi4zMi02OTYuMy4yLmVsNi5pNjg2IG9uIGFuIGk2ODYKCmlaMnpl ZDk2ZTQ2MmF5cjBxemw2czhaIGxvZ2luOg==" }
Exception return example
XML format
<Error> <RequestId>C38E0D94-C18B-44F3-8C05-6E35BE334088</RequestId> <HostId>ecs.aliyuncs.com</HostId> <Code>NotSupported</Code> <Message>The operation is not supported for "i-j5e42sbbthlokkaXXXXX".</Message> </Error>
JSON format
{ "RequestId": "C38E0D94-C18B-44F3-8C05-6E35BE334088", "HostId": "ecs.aliyuncs.com", "Code": "NotSupported", "Message": "The operation is not supported for "i-j5e42sbbthlokkaXXXXX"." }
Error code
The following are error codes unique to this interface. For more error codes, please visit the API Error Center.The above is the detailed content of Obtain the system command line output of an instance and return the data after encoding it in Base64. For more information, please follow other related articles on the PHP Chinese website!