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
- Go to Google Cloud Console
- Create a new project or select an existing one
- Navigate to Compute Engine > VM instances
Step 2: Create Your Free Tier VM
- Click Create Instance
- Configure your instance:
- Name: Choose a descriptive name (e.g.,
my-free-vps) - Region: Select
us-east1,us-west1, orus-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
- Name: Choose a descriptive name (e.g.,
- Under Firewall, check:
- Allow HTTP traffic
- Allow HTTPS traffic
- 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
- Sign up at Cloudflare
- Click Add a Site
- Enter your domain name
- Select the Free plan
Step 2: Update Nameservers
- Cloudflare will provide two nameservers (e.g.,
emma.ns.cloudflare.com) - Go to your domain registrar
- Update nameservers to point to Cloudflare
- Wait 24-48 hours for propagation (usually faster)
Step 3: Add DNS Records
- In Cloudflare dashboard, go to DNS > Records
- Add an A record:
- Name:
@(for root domain) or subdomain - IPv4 address: Your VM’s external IP
- Proxy status: Proxied (orange cloud)
- Name:
- Add a CNAME record for www:
- Name:
www - Target:
@or your domain - Proxy status: Proxied
- Name:
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.