TerminateSessionCommand

Permanently ends a session and closes the data connection between the Session Manager client and SSM Agent on the managed node. A terminated session can't be resumed.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { SSMClient, TerminateSessionCommand } from "@aws-sdk/client-ssm"; // ES Modules import
// const { SSMClient, TerminateSessionCommand } = require("@aws-sdk/client-ssm"); // CommonJS import
const client = new SSMClient(config);
const input = { // TerminateSessionRequest
  SessionId: "STRING_VALUE", // required
};
const command = new TerminateSessionCommand(input);
const response = await client.send(command);
// { // TerminateSessionResponse
//   SessionId: "STRING_VALUE",
// };

TerminateSessionCommand Input

See TerminateSessionCommandInput for more details

Parameter
Type
Description
SessionId
Required
string | undefined

The ID of the session to terminate.

TerminateSessionCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
SessionId
string | undefined

The ID of the session that has been terminated.

Throws

Name
Fault
Details
InternalServerError
server

An error occurred on the server side.

SSMServiceException
Base exception class for all service exceptions from SSM service.