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
- Install and configure the Nebius AI Cloud CLI.
-
Check that your project ID is saved in the Nebius AI Cloud CLI profile configuration:
- 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.
- Set up SSH access to the VM.
-
Get the project ID and save it to an environment variable:
-
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
-
Create a service account for the tunnel agent and save its ID:
-
Create a group for Nebius Tunnels service accounts and save its ID:
-
Grant the group the
applicationtunnel.agentrole for the tunnel: -
Add the service account to the group:
-
Create an authorized key pair:
-
Upload the public key and save its ID:
Connect to the VM
-
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.
-
Note the values you’ll need to fill in the agent configuration on the VM:
-
Connect to the VM:
Prepare and deploy a local HTTP service
Follow this section on your VM via SSH.
busybox’s HTTP server on your VM:
-
Install the
busyboxpackage: -
In your home directory, create a
www/directory and add an HTML file to serve via the tunnel: -
Create a unit file:
In the unit file, replace
<username>with the username you used to connect to the VM. -
Apply the new unit file, start the
busybox-httpdservice and check its status:
Run the tunnel agent
Follow this section on your VM via SSH.
-
Download and extract the
nebius-tunnel-agentbinary for Linux x86_64: -
Create
config.yamlfor 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
-
Run the agent:
When the agent connects, it returns the public endpoint in the following format:Where:
service_nameis theservices.namevalue from the agent configuration.tunnel_masked_IDis the mask of the tunnel ID without theapplicationtunnel-prefix and regional routing code. For example, forapplicationtunnel-e00abcdef123456789, the tunnel ID mask isabcdef123456789.regionis the region of the project where the tunnel was created, for exampleeu-north1.
Access the service on the VM via the tunnel
On your local machine, addhttps:// to the beginning of the public endpoint address and open it in your browser, or run curl https://<public_endpoint> in your terminal.