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, create a Compute virtual machine (VM) with the agent preinstalled, deploy a demo service on it, 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. Make sure you are in a group that has the admin role within your tenant or project; for example, the default admins group. You can check this in the Administration → IAM section of the web console. You need this role to create a group and grant it a role for the tunnel. You also need the admin role to create a VM with a service account attached. Create the service account in the same project as the VM. The tunnel agent authenticates as this service account, so it only needs the applicationtunnel.agent role for the tunnel. It doesn’t need any Compute permissions.
    A VM’s service account is set only at creation and can’t be changed afterwards. To attach a different service account, create a new VM.
  2. Install and configure the Nebius AI Cloud CLI.
  3. Check that your project ID is saved in the Nebius AI Cloud CLI profile configuration:
  4. Get the subnet ID for the VM you create.
  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 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

On the VM, the tunnel agent authenticates through the instance metadata service — no need to generate or copy keys.
  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:

Create the VM

  1. Prepare the cloud-init configuration file. You’ll attach it to the VM when you create it. Save the following configuration to a file named cloud-init.yaml in your working directory. Before saving, replace:
    • <username> with the username you’ll use to connect
    • <public_SSH_key> with your SSH public key
    • <tunnel_ID> with the value of $TUNNEL_ID
    This configuration enables the following actions:
    • Add a username and a public SSH key to the VM.
    • Download the tunnel agent, verify its checksum and install it as a systemd service running under a dedicated tunna system user.
    • Authenticate by using the service account attached to the VM, through the instance metadata service. No key files are involved.
    • Create the web Nebius Tunnels service that exposes 127.0.0.1:8080 on the VM.
  2. Create the VM:
    In the command, specify the subnet ID from Prerequisites and the ID of the service account you created earlier.
  3. Get the public IP address of the VM:
    In the command, specify the name of the VM you created.
  4. Connect to the VM:

Prepare and deploy a local HTTP service

Follow this section on your VM via SSH.
Start the busybox 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:

Verify the tunnel agent

Follow this section on your VM via SSH.
The cloud-init configuration installs and starts the tunnel agent automatically when the VM boots, so there’s nothing left to run manually. To confirm that the agent registered with the tunnel, check the status of the service:
For live logs, run:
If the agent doesn’t register, check the logs for these common causes:
  • The VM has no service account attached. systemctl status still shows active (running), but the agent retries indefinitely, showing IMDS token request failed: 404 Not Found followed by connection closed before registering. You can’t attach a service account to an existing VM. Create a new one with --service-account-id instead.
  • The attached service account doesn’t have the applicationtunnel.agent role. The agent authenticates, but the tunnel rejects the connection. Grant the role to the service account as described earlier in this guide.
In the log output, the agent reports 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.