DescribeTerminalSessions
Queries the Session Manager session history.
Operation description
You can query Session Manager session records created within the last 30 days. The maximum number of retained successful session records is 1,000.
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 to return per page when paging in a paged query. Maximum value: 100. Default value: 10. |
10 |
| NextToken |
string |
No |
The pagination token. Set the value to the NextToken value returned from the previous API call. |
AAAAAdDWBF2**** |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3**** |
| NextToken |
string |
The pagination token returned in the current call. |
AAAAAdDWBF2**** |
| Sessions |
object |
||
| Session |
array<object> |
The list of sessions. |
|
|
array<object> |
The session information. |
||
| CreationTime |
string |
The time when the session was created. The time is in ISO 8601 format and the UTC time zone. |
2024-01-19T09:15:46Z |
| TargetServer |
string |
The destination service address in the VPC accessed through the instance. |
192.168.0.246 |
| PortNumber |
integer |
The port number of the ECS instance used for data forwarding. If the port number for data forwarding is not specified, this value is empty. |
22 |
| PrincipalId |
string |
The identity identifier. The value varies based on the identity type specified by
|
123456xxxx |
| Username |
string |
The username used for the connection. |
root |
| ClientIP |
string |
The client IP address of the remote connection. |
192.168.1.1 |
| IdentityType |
string |
The identity type. Valid values:
|
RAMUser |
| SessionId |
string |
The session ID. |
s-hz023od0x9**** |
| Connections |
object |
||
| Connection |
array<object> |
The list of connection information. |
|
|
object |
The connection information. |
||
| ClosedReason |
string |
The reason why the connection was closed. This parameter is returned only when the Status is Disconnected, Terminated, or Failed. Valid values:
|
AgentNeedUpgrade |
| EndTime |
string |
The time when the connection was closed. The time is in ISO 8601 format and the UTC time zone. |
2024-01-19T09:16:46Z |
| Status |
string |
The session status. Valid values:
|
Connecting |
| StartTime |
string |
The time when the connection was established. The time is in ISO 8601 format and the UTC time zone. |
2024-01-19T09:16:40Z |
| InstanceId |
string |
The instance ID. |
i-bp1i7gg30r52z2em**** |
| FailedDetail |
string |
The details of the connection failure reason. This parameter is returned only when the Status is Failed. |
The Session Manager is closed normally. |
Examples
Success response
JSON format
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
"NextToken": "AAAAAdDWBF2****",
"Sessions": {
"Session": [
{
"CreationTime": "2024-01-19T09:15:46Z",
"TargetServer": "192.168.0.246",
"PortNumber": 22,
"PrincipalId": "123456xxxx",
"Username": "root",
"ClientIP": "192.168.1.1",
"IdentityType": "RAMUser",
"SessionId": "s-hz023od0x9****",
"Connections": {
"Connection": [
{
"ClosedReason": "AgentNeedUpgrade",
"EndTime": "2024-01-19T09:16:46Z",
"Status": "Connecting",
"StartTime": "2024-01-19T09:16:40Z",
"InstanceId": "i-bp1i7gg30r52z2em****",
"FailedDetail": "The Session Manager is closed normally."
}
]
}
}
]
}
}
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 service is available in the region. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.