Creating a Managed SSH Session in Bastion

Create a managed SSH session.

Before creating a managed SSH session, verify the following information:

You must have the following information about the target resource you intend to create a session for:
  • Valid credentials to sign in to the target resource, such as operating system and database
  • One of the following:
    • The name and compartment of the target compute instance 
    • The IP address and port of the target resource

Ensure that you have the public key file of the SSH key pair that you plan to use to connect to the session. To learn more, see Managing Key Pairs on Linux Instances.

    1. On the Bastions list page, select the bastion that you want to create a session in. If you need help finding the list page or the bastion, see Listing Bastions.
    2. On the details page, select the Sessions tab or link.
    3. Select Create session.
    4. Select Managed SSH session to connect to a Compute instance that has a running OpenSSH server and has Oracle Cloud Agent enabled.
    5. Enter a name for the new session.

      Avoid entering any confidential information in this field.

    6. Enter a valid operating system username for the target instance.

      The default username on most platform images is opc.

    7. Select the target Compute instance. If needed, change the compartment to find the instance. Only active instances are listed.
    8. Under Add SSH key, provide the public key file of the SSH key pair that you want to use for the session.

      Later, when you connect to the session, you must provide the private key of the same SSH key pair.

    9. (Optional) Expand Advanced options and configure the advanced settings for the session:
      • Change the maximum amount of time that any session on this bastion can remain active by entering a value for Maximum session time-to-live. Provide a value of at least 30 minutes that doesn't exceed 180 minutes (3 hours). You can delete a session before it expires.
      • Change the specific port or IP address to connect to on the target compute instance. By default, the session uses port 22 and the primary IP address of the instance.
    10. When you're finished, select Create session.
  • Use the oci bastion session create-managed-ssh command and required parameters to create a managed SSH session:

    oci bastion session create-managed-ssh --bastion-id <bastion_ocid> [OPTIONS]

    For a complete list of flags and variable options for CLI commands, see the Command Line Reference.

  • Run the CreateSession operation to create a managed SSH session.