Configure SSH Tunneling with Mac / Linux Using SSH


Set up tunneling if you prefer to work directly from your local environment using your own browsers to access the Data Hub Service endpoints.

Before you begin

You need:

About this task

Set up secure shell (SSH) tunneling to access the Data Hub Service (DHS) endpoints from your local environment. In this task, you will use SSH with Mac or Linux to set up SSH tunneling between your browsers and DHS.
Important: For this task, you need the SERV-ADMIN portal role. See Portal Roles.
Important: If your DHS uses private endpoints, you can set up SSH tunneling. See Getting Started with Data Hub Service in AWS, and follow the peered configuration.


  1. Go to the MarkLogic Data Hub Service home page.
  2. Navigate to your DHS to view the SSH tunneling script.
    • In the Service column, click the service name.

    Private Standard MarkLogic Data Hub Service

    Tip: You can customize your dashboard with column sorting, column configuring, and services searching and filtering. See Customize DHS Dashboard.
  3. In the Data Hub Service page, click Action to open the drop-down menu.
  4. In the Action drop-down menu, click SSH Tunneling Script to display the popup with the current settings.

    Data Hub Service SSH script

    • In the popup, copy the script to your clipboard:
      • highlight and copy the script, or
      • click the copy script icon ()

    Your script will look similar to the following:

       ssh -i $SSH_PEM_KEY -N \
       -L 5432:DHS_ENDPOINT:5432 \
       -L 8002:DHS_ENDPOINT:8002 \
       -L 8005:DHS_ENDPOINT:8005 \
       -L 8010:DHS_ENDPOINT:8010 \
       -L 8013:DHS_ENDPOINT:8013 \
       -L 8012:DHS_ENDPOINT:8012 \
       -L 8011:DHS_ENDPOINT:8011 \
       -L 8020:DHS_ENDPOINT:8020 \
    Note: Replace DHS_ENDPOINT with the endpoints associated with each port number per your service.
    • To edit the script, paste to a text file.
  5. In the text file, replace the following per your configuration: SSH_PEM_KEY and BASTION_EC2
    Value Replace With
    SSH_PEM_KEY The path to your private key file on your local machine. For details, see Creating a Key Pair.
    BASTION_EC2 The public IP address, host name, or Fully Qualified Domain Name (FQDN) of your bastion host.

    Click the following link to view a full list of configure SSH tunneling resources.

  6. In the command prompt, run the modified script.
    • You can run the script locally, or
    • You can save the script to a text file and run locally. Use the following command:
      • sh /path/to/file.txt


Important: Developers with an existing installation of MarkLogic will notice the potential conflict with use of port 8002. To avoid the conflict, use another port number for the tunnel or change the "Manage" port in your local MarkLogic installation.

What to do next

Ingest and Curate Your Data.