Skip to main content

Lifetime Free Google Server

ยท 3 min read

Free

Source Imgur

We might want to quickly deploy our code to make sure it works or just want to have a server to play around with for free.

Certainly, you can!

As a student, I wanted to know and use services for free and forever. Thats the background of this post and the previous post (go check if you haven't read it)

But how do we get that?

Google Cloud provides us to use free tier compute engine.

Without further, let's go!

First time know about this, I certainly say "this is for me".

Setup Server

  1. Go to GCP then signup/in.

    If you are new, you can get $300 credit by use free trial (click on 'Get started for free' or here)

  2. Go to Compute Engine

    Enable Compute Engine API here if not enabled

    Setup billing, need a credit card but dont worry you won't get charged.

  3. Create VM, instance

    Make sure you create in free tier locations (us-west1, us-central, us-east1) with machine type e2-micro and standard persistent disk up to 30GB, as stated here.

    Also, make sure allow HTTP and HTTPS.

    Configuration VM 1

    Configuration VM 2

  4. Connect via SSH

Thats it.

Testing

Let's quickly try our new server by creating an express app.

Install dependencies

  1. Connect via SSH

  2. Update package Linux

    sudo apt update
  3. Install Node.js

    sudo apt install nodejs

    Check with:

    node -v
    Output:
    v8.10.0
  4. Install NPM

    sudo apt install npm

Create Express

Quick start create express app here

  1. Install executable

    npm install -g express-generator@4
  2. Create app

    express /tmp/foo && cd /tmp/foo
  3. Install dependencies

    npm install
  4. Start server

    Before we start, we have to change port server 3000 to 80.

    sudo pico bin/www

    Search for 3000 or go to line (CTRL + SHIFT + _) 15 and change into 80.

    Exit (CTRL + X).

    Run server

    sudo npm start
  5. See public

    Navigate to Compute Engine and click external IP.

    You'll find something like this:

    Express App

P.S. This is for testing only, make sure to correct deploy your app.

Next Step

Deploy project on the server and play around with.

NOTE: The server running for free, but Google might charge if you are over the free usage limit. Also, Google may change their terms for "forever" (read: Google Photos)

IMPORTANT: You may be charged because of Network Egress to China and Australia.

Reach Me

Any issue? Reach me at [email protected]