Skip to content

Port Forwarding and Network Access

Velda provides several methods to connect to open ports from running services and workloads.

1. Use Session Name as Hostname

The simplest way is to use the session name directly as the hostname. This works when connecting from another session on the same instance.

The service must allow connection from external address.

# Start a web server in a session
vrun -s web python -m http.server 8000 &

# Access from another session
curl web:8000

2. Port-Forward While Running Workload

Forward a port while launching your workload, making it accessible via localhost within the instance:

# Forward port and run service
vrun -p 8000:8000 python -m http.server 8000 &

# Access via localhost
curl localhost:8000

3. Port-Forward for Browser or Remote Access

Enable access from your local machine to services running in Velda:

Step 1: Start your workload in a session

vrun -s web python -m http.server 8000

Step 2: From your local machine (requires Velda CLI)

velda port-forward -s web --port 8000 -l :8000

After running this command, access the service at http://localhost:8000 in your local browser.

4. Use Proxy (Velda Cloud / Enterprise only)

Most Velda deployments include a proxy server for easy HTTP/HTTPS access.

If your workload runs as:

vrun -s web python -m http.server 8000

And your Velda service is hosted at velda.example.com, access it at:

http://8000-web-[instance-name].i.velda.example.com

Note: For endpoint security, this option is currently only available with enterprise/velda.cloud.

5. Use VS Code (or Your IDE) Port Forwarding

If you're connected via VS Code, you can use its built-in port-forwarding feature:

  1. Open the Ports panel in VS Code
  2. Click "Forward a Port"
  3. Enter the port number (e.g., 8000)
  4. Access via localhost:8000 on your local machine
  5. Use port-forwarding with vrun to forward ports from other sessions.

Best Practices

1. Use Named Sessions for Important Workloads

# Good: Named session for easy reattachment
vrun -s my-training python train.py

# Less ideal: Anonymous session
vrun python train.py

2. Match Resource Pool to Workload

# Good: GPU pool for GPU workload
vrun -P gpu-a100 python train.py

# Wasteful: GPU pool for CPU-only workload
vrun -P gpu-a100 python preprocess.py  # Should use cpu-large

3. Use Port Forwarding for Services

# Good: Explicit port forwarding
vrun -s jupyter -p 8888:8888 jupyter notebook

# Less secure: Exposing on all interfaces without forwarding
vrun jupyter notebook --ip=0.0.0.0