Skip to main content
The Nebius Tunnels service exposes a service to the internet without configuring firewall ports. Your service could be running anywhere: on a VM, your local machine or another cloud provider. In this guide, you’ll create a tunnel, prepare access for a tunnel agent, connect to a Compute virtual machine (VM), deploy a demo service on it, run the tunnel agent and access the service through a public tunnel URL.

Costs

Nebius Tunnels is provided free of charge during preview. If you create a VM for this guide, Nebius AI Cloud charges you for Compute resources.

Prerequisites

  1. Install and configure the Nebius AI Cloud CLI.
  2. Check that your project ID is saved in the Nebius AI Cloud CLI profile configuration:
  3. Create a Compute VM with a public IP address or select an existing one that has a public IP address. You need to use this address only to connect to the VM over SSH. Tunnels don’t require a public IP address or any firewall configuration on the VM.
  4. Set up SSH access to the VM.
  5. Get the project ID and save it to an environment variable:
  6. Get the tenant ID and save it to an environment variable:
    You’ll need the tenant ID when granting the service account access to Nebius Tunnels.

Steps

Create a tunnel

Create a tunnel and save its ID:

Prepare agent access

  1. Create a service account for the tunnel agent and save its ID:
  2. Create a group for Nebius Tunnels service accounts and save its ID:
  3. Grant the group the applicationtunnel.agent role for the tunnel:
  4. Add the service account to the group:
  5. Create an authorized key pair:
  6. Upload the public key and save its ID:

Connect to the VM

  1. Copy the service account private key to the VM:
    In subsequent steps, the tunnel agent running on the VM uses this private key to authenticate as the service account that you set up earlier.
  2. Note the values you’ll need to fill in the agent configuration on the VM:
  3. Connect to the VM:

Prepare and deploy a local HTTP service

Follow this section on your VM via SSH.
Start busybox’s HTTP server on your VM:
  1. Install the busybox package:
  2. In your home directory, create a www/ directory and add an HTML file to serve via the tunnel:
  3. Create a unit file:
    In the unit file, replace <username> with the username you used to connect to the VM.
  4. Apply the new unit file, start the busybox-httpd service and check its status:

Run the tunnel agent

Follow this section on your VM via SSH.
  1. Download and extract the nebius-tunnel-agent binary for Linux x86_64:
  2. Create config.yaml for the agent:
    In the file, replace the placeholders with the values you created locally:
    • <tunnel_ID> with the value of $TUNNEL_ID
    • <service_account_ID> with the value of $SA_ID
    • <authorized_key_ID> with the value of $PUBLIC_KEY_ID
  3. Run the agent:
    When the agent connects, it returns the public endpoint in the following format:
    Where:
    • service_name is the services.name value from the agent configuration.
    • tunnel_masked_ID is the mask of the tunnel ID without the applicationtunnel- prefix and regional routing code. For example, for applicationtunnel-e00abcdef123456789, the tunnel ID mask is abcdef123456789.
    • region is the region of the project where the tunnel was created, for example eu-north1.

Access the service on the VM via the tunnel

On your local machine, add https:// to the beginning of the public endpoint address and open it in your browser, or run curl https://<public_endpoint> in your terminal.