Queries the session history of Session Manager.
Operation description
You can query Session Manager session records created within the last 30 days. A maximum of 1,000 successful records are retained.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ecs:DescribeTerminalSessions |
list |
*Instance
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
The region ID. |
cn-hangzhou |
| InstanceId |
string |
No |
The instance ID. |
i-bp1i7gg30r52z2em**** |
| SessionId |
string |
No |
The session ID. |
s-hz023od0x9**** |
| MaxResults |
integer |
No |
The maximum number of entries per page for a paged query. Maximum value: 100. Default value: 10. |
10 |
| NextToken |
string |
No |
The pagination token. Set this parameter to the NextToken value returned in the previous API call. |
AAAAAdDWBF2**** |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| NextToken |
string |
The pagination token returned in this call. |
AAAAAdDWBF2**** |
| RequestId |
string |
The request ID. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3**** |
| Sessions |
object |
||
| Session |
array<object> |
The session list. |
|
|
array<object> |
The session information. |
||
| ClientIP |
string |
The client IP address of the remote connection. |
192.168.1.1 |
| Connections |
object |
||
| Connection |
array<object> |
The connection information list. |
|
|
object |
The connection information. |
||
| ClosedReason |
string |
The reason why the connection was closed.
This parameter is returned only when the Status is
|
AgentNeedUpgrade |
| EndTime |
string |
The time when the connection ended. The time is displayed in ISO 8601 format in UTC. |
2024-01-19T09:16:46Z |
| FailedDetail |
string |
The details of the connection failure. This parameter is returned only when the Status is Failed. |
The Session Manager is closed normally. |
| InstanceId |
string |
The instance ID. |
i-bp1i7gg30r52z2em**** |
| StartTime |
string |
The time when the connection started. The time is displayed in ISO 8601 format in UTC. |
2024-01-19T09:16:40Z |
| Status |
string |
The session status. Valid values:
|
Connecting |
| CreationTime |
string |
The time when the session was created. The time is displayed in ISO 8601 format in UTC. |
2024-01-19T09:15:46Z |
| IdentityType |
string |
The identity type. Valid values:
|
RAMUser |
| PortNumber |
integer |
The port number of the ECS instance used for data forwarding. If no port number is configured for data forwarding, this value is empty. |
22 |
| PrincipalId |
string |
The identity ID. The value varies based on the IdentityType:
|
123456xxxx |
| SessionId |
string |
The session ID. |
s-hz023od0x9**** |
| TargetServer |
string |
The address of the target server in the VPC accessed through the instance. |
192.168.0.246 |
| Username |
string |
The username used for the connection. |
root |
Examples
Success response
JSON format
{
"NextToken": "AAAAAdDWBF2****",
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
"Sessions": {
"Session": [
{
"ClientIP": "192.168.1.1",
"Connections": {
"Connection": [
{
"ClosedReason": "AgentNeedUpgrade",
"EndTime": "2024-01-19T09:16:46Z",
"FailedDetail": "The Session Manager is closed normally.",
"InstanceId": "i-bp1i7gg30r52z2em****",
"StartTime": "2024-01-19T09:16:40Z",
"Status": "Connecting"
}
]
},
"CreationTime": "2024-01-19T09:15:46Z",
"IdentityType": "RAMUser",
"PortNumber": 22,
"PrincipalId": "123456xxxx",
"SessionId": "s-hz023od0x9****",
"TargetServer": "192.168.0.246",
"Username": "root"
}
]
}
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidParameter.NextToken | The specified parameter NextToken is not valid. | The specified parameter NextToken is illegal. |
| 400 | InvalidParameter.MaxResults | The specified parameter MaxResults is not valid. | The specified parameter MaxResults is illegal. |
| 500 | InternalError | An error occurred when you dispatched the request. | An error occurred while sending the request, please try again later. |
| 403 | InvalidParameterCharacter | The specified parameter %s contains illegal characters. | |
| 403 | Operation.Forbidden | The operation is not permitted. | The operation is not supported. |
| 404 | InvalidRegionId.NotFound | The specified parameter RegionId does not exist. | The specified RegionId does not exist. Check whether the product is available in this region. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.