Method: Aws::SSM::Client#start_session

Defined in:
lib/aws-sdk-ssm/client.rb

#start_session(params = {}) ⇒ Types::StartSessionResponse

Initiates a connection to a target (for example, a managed node) for a Session Manager session. Returns a URL and token that can be used to open a WebSocket connection for sending input and receiving outputs.

<note markdown=“1”> Amazon Web Services CLI usage: start-session is an interactive command that requires the Session Manager plugin to be installed on the client machine making the call. For information, see [Install the Session Manager plugin for the Amazon Web Services CLI] in the *Amazon Web Services Systems Manager User Guide*.

Amazon Web Services Tools for PowerShell usage: Start-SSMSession

isn’t currently supported by Amazon Web Services Tools for PowerShell on Windows local machines.

</note>

[1]: docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html

Examples:

Request syntax with placeholder values


resp = client.start_session({
  target: "SessionTarget", # required
  document_name: "DocumentARN",
  reason: "SessionReason",
  parameters: {
    "SessionManagerParameterName" => ["SessionManagerParameterValue"],
  },
})

Response structure


resp.session_id #=> String
resp.token_value #=> String
resp.stream_url #=> String

Options Hash (params):

  • :target (required, String)

    The managed node to connect to for the session.

  • :document_name (String)

    The name of the SSM document you want to use to define the type of session, input parameters, or preferences for the session. For example, SSM-SessionManagerRunShell. You can call the GetDocument API to verify the document exists before attempting to start a session. If no document name is provided, a shell to the managed node is launched by default. For more information, see [Start a session] in the *Amazon Web Services Systems Manager User Guide*.

    [1]: docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-sessions-start.html

  • :reason (String)

    The reason for connecting to the instance. This value is included in the details for the Amazon CloudWatch Events event created when you start the session.

  • :parameters (Hash<String,Array>)

    The values you want to specify for the parameters defined in the Session document. For more information about these parameters, see

    Create a Session Manager preferences document][1

    in the *Amazon Web

    Services Systems Manager User Guide*.

    [1]: docs.aws.amazon.com/systems-manager/latest/userguide/getting-started-create-preferences-cli.html

See Also:



11494
11495
11496
11497
# File 'lib/aws-sdk-ssm/client.rb', line 11494

def start_session(params = {}, options = {})
  req = build_request(:start_session, params)
  req.send_request(options)
end