End a session - Amazon Systems Manager
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

End a session

You can end a session that you started in your account using the Amazon Systems Manager console or the Amazon Command Line Interface (Amazon CLI). When you choose the Terminate button for a session in the console or call the TerminateSession API action by using the Amazon CLI, Session Manager permanently ends the session and closes the data connection between the Session Manager client and SSM Agent on the managed node. You can't resume a terminated session.

If there is no user activity in an open session for 20 minutes, the idle state triggers a timeout. Session Manager doesn't call TerminateSession, but it does close the underlying channel. You can't resume a session closed because of idle timeout.

We recommend always explicitly terminating a session by using the terminate-session command, when using the Amazon CLI, or the Terminate button when using the console. (Terminate buttons are located on both the session window and main Session Manager console page.) If you only close a browser or command window, the session remains listed as Active in the console for 30 days. When you don't explicitly terminate a session, or when a session times out, any processes that were running on the managed node at the time will continue to run.

Ending a session (console)

You can use the Amazon Systems Manager console to end a session in your account.

To end a session (console)
  1. Open the Amazon Systems Manager console at https://console.amazonaws.cn/systems-manager/.

  2. In the navigation pane, choose Session Manager.

  3. For Sessions, choose the option button to the left of the session you want to end.

  4. Choose Terminate.

Ending a session (Amazon CLI)

To end a session using the Amazon CLI, run the following command. Replace session-id with your own information.

aws ssm terminate-session \ --session-id session-id

For more information about the terminate-session command, see terminate-session in the Amazon Systems Manager section of the Amazon CLI Command Reference.