Skip to main content

Deploy your first compute instance

12 min tutorial

What you'll build​

By the end of this tutorial you'll have a Compute Instance running in your account, reachable over SSH and over HTTP, ready to host a real application.

Prerequisites​

  • A SonicInfra account with billing enabled.
  • An SSH key pair on your local machine.
  • The sonic CLI installed.
Show me!

Open Compute Instances

Click Compute Instances in the sidebar.

Create a new instance

Click + Create Compute Instance.

Fill out the instance details

Fill in the fields:

  • Instance Type — CPU and memory size, as {family}.{cores} (4Gi RAM per core). Pick ne.2 for this tutorial.
  • Image — the OS image to use for the root disk. Pick ubuntu-24-04.

Add an SSH key

Under SSH Authorized Keys, click + Add.

Choose the key

Click the field and pick an existing key from the list.

Don't have one yet? Click + Create SSH Key at the bottom of the list to add one without leaving this page — it opens the same form as this standalone guide, if you'd rather follow it on its own:

Create an SSH key

Before you create it

Compute instances are a paid resource — your organization needs billing set up before you can create one.

tip

Haven't set up billing yet? Here's how to add a payment method first.

Create the instance

Click Create Compute Instance.

  • instanceType — ne.2 — 2 cores, 8Gi RAM. Sized for this tutorial; pick a larger type for a real workload.
  • cloudInit.ssh_authorized_keys — The key you picked in the previous step. SonicInfra injects it into the instance at boot, which is what makes sonic ssh work in the next step with no extra setup.

Connect over SSH

If you added an SSH key in the previous step, connect directly. sonic tunnels the connection through our gateway, so there's no public IP to look up:

sonic ssh web-01

Didn't add a key yet? Attach one after the fact instead:

sonic ssh-copy-id web-01
sonic ssh web-01
tip

Run sonic setup-ssh once, then you can run this instead:

ssh web-01.sonicinfra

Install your app

Install a runtime and pull your application code. This example uses Node.js:

curl -fsSL https://deb.nodesource.com/setup_20.x | sudo bash -
sudo apt-get install -y nodejs git
git clone https://github.com/you/your-app.git
cd your-app && npm ci && npm run build
tip

Use a process manager like systemd or pm2 so your app restarts on reboot or crash.

Open L7 Load Balancers

Instances don't have public IPs directly — create an L7 load balancer to route a domain to your app over HTTP/HTTPS. Click L7 Load Balancers in the sidebar.

Create a new load balancer

Click + Create L7 Load Balancer.

Expose it to the internet

Fill in the fields, then click Create L7 Load Balancer:

  • Instance Name — the compute instance to expose. Pick web-01.
  • Port — the port your app listens on. Use 3000 for this tutorial's Node.js example.
  • URLs — the domain (and optional path) to route to it. Use a domain you actually control, e.g. app.example.com.

Point your domain

Its row is highlighted below — click it to open the details panel.

Find the address to point to

Find the assigned address under External IP, use that to add an A record to your domain registrar. This happens outside SonicInfra, so come back here once it's done.

Next steps​