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. That's 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”.
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-east1) with machine type
standard persistent disk up to 30GB, as stated here.
Also, make sure to allow HTTP and HTTPS.
4. Connect via SSH
Let’s quickly try our new server by creating an express app.
1. Connect via SSH
2. Update package Linux
sudo apt update
3. Install Node.js
sudo apt install nodejs
$ node -v
4. Install NPM
sudo apt install npm
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
4. Start server
Before we start, we have to change port server
sudo pico bin/www
3000 or go to line (CTRL + SHIFT + _) 15 and change into
Exit (CTRL + X).
sudo npm start
5. See public
Navigate to Compute Engine and click external IP.
You’ll find something like this:
P.S. This is for testing only, make sure to correct deploy your app.
Deploy project on the server and play around with.
IMPORTANT: You may be charged because of Network Egress to China and Australia.