How to setup a free VPS

Intro

This is for those of you who have gotten started on their dreams of self-hosting anything, only to be thwarted by CGNAT. want a VPS no cost without worrying to much about switching providers after your free trial ends.

The Main Providers are all Free, for a little bit

Azure does it, AWS does it, DigitalOcean does it, so does Google. The trick is finding one that will be always free. Google’s micro tier has a free plan! So we’re going to use Google. If you just signed up, they also give you $300 in credits to spend over your first three months, after which you’ll have to give financial details. Don’t worry, as long as you stay within their Free plan, you won’t be charged. Read More Here

Creating a New VM in Google Cloud

Step 1: Set Up Your Google Cloud Account

  1. Go to Google Cloud Console
  2. Create a new project or select an existing one
  3. Navigate to Compute Engine > VM instances

Step 2: Create Your Free Tier VM

  1. Click Create Instance
  2. Configure your instance:
    • Name: Choose a descriptive name (e.g., my-free-vps)
    • Region: Select us-east1, us-west1, or us-central1 (free tier eligible)
    • Machine type: Choose e2-micro (0.25-1 GB memory)
    • Boot disk: Ubuntu 22.04 LTS, 30 GB standard persistent disk
  3. Under Firewall, check:
    • Allow HTTP traffic
    • Allow HTTPS traffic
  4. Click Create

Step 3: Configure Firewall Rules

Create firewall rules for your services:

# SSH to your VM
gcloud compute ssh your-instance-name

# Update system
sudo apt update && sudo apt upgrade -y

Acquiring a Domain

Free Options

Option 1: Freenom (Free)

  • Visit Freenom
  • Search for available domains (.tk, .ml, .ga, .cf, .gq)
  • Register for free (renewable annually)

Option 2: Afraid.org (Free Subdomains)

  • Visit FreeDNS
  • Create an account
  • Choose from hundreds of free subdomains
  • Built-in DDNS support

Option 3: Purchase Your Own

  • Use providers like Namecheap, Google Domains, or Cloudflare
  • Costs typically $10-15/year for .com domains

Configuring Your Domain in Cloudflare

Step 1: Add Your Site

  1. Sign up at Cloudflare
  2. Click Add a Site
  3. Enter your domain name
  4. Select the Free plan

Step 2: Update Nameservers

  1. Cloudflare will provide two nameservers (e.g., emma.ns.cloudflare.com)
  2. Go to your domain registrar
  3. Update nameservers to point to Cloudflare
  4. Wait 24-48 hours for propagation (usually faster)

Step 3: Add DNS Records

  1. In Cloudflare dashboard, go to DNS > Records
  2. Add an A record:
    • Name: @ (for root domain) or subdomain
    • IPv4 address: Your VM’s external IP
    • Proxy status: Proxied (orange cloud)
  3. Add a CNAME record for www:
    • Name: www
    • Target: @ or your domain
    • Proxy status: Proxied

You Don’t Need to Buy Static IPs

Free Tier VM’s come with public-facing ephemeral ips. That means they’re able to talk to the internet! So, technically we can set up our server or vpn or whatever. But it’s not a permanent or elegant solution. Whenever your VM is spun up, and sometimes when it’s restarted, its ip will refresh. This means it will lose contact with everything it’s supposed to talk to. You have a few options: Setting up DDNS (which is trivial with afraid.org domains if you’re going the totally-free route), Updating everything manually whenever you notice the site is down, or setting up some kind of automation. In my case, I built an ansible playbook that would update my homeserver, the VPS, and Cloudflare records whenever the homeserver loses contact with the VPS. It’s much too overkill to show you THAT approach, so I’ll let you in on a little secret— Cloudflare also offers DDNS for free by way of a lightweight service called ddclient.

Logo

© 2026 Martin Munguia