visit
Firstly, you'll need a Google Cloud account. If you don't have one already, head over to
Then you should click on “My Project“
(image 2) and then click on “NEW PROJECT“
(image 3) button.
On this page, you will see all existing projects that you have access to see. If you are working on an organization and have an account on it, you will see all projects of the current company.
On the project settings, you can set up a name and an organization, if exists (Image 4).
Don’t forget to select your current project on the list. Finally, you will see “Your project name“
on the main Google Console page.
To deploy your Node.js application, you'll need to install Google Cloud SDK. You can download it
gcloud auth login
This will open a new browser window where you can log in with your Google account.
gcloud config set project your-project-id
Writing a simple nodejs project I have detailed explained in my previous article. The main project code will be:
const http = require('http');
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World\n');
});
server.listen(8080, '0.0.0.0', () => {
console.log('Server running at //0.0.0.0:8080/');
});
{
"name": "hackernoon",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"start": "node app.js"
},
"keywords": [],
"author": "",
"license": "ISC"
}
Also, you need to create a app.yaml
file for gcloud and save it in the project folder. Put this code:
runtime: nodejs18
service: default
now requires an active . You will need to add one, otherwise, you will not be able to deploy your nodejs app on GCP. Enable Cloud Functions, after adding billing info, your Google account will have free 300 creds on it.
Run cmd.exe
from the project folder and execute this command:
gcloud app create
This command will enable the App Engine on your current project. You should choose a location after the gcloud will do everything for you.
Creating App Engine application in project [ivory-studio-387214] and region [europe-central2]....done.
Success! The app is now created. Please use `gcloud app deploy` to deploy your first app.
gcloud app deploy --quiet app.yaml --promote --stop-previous-version --version main-v1
You will see the message that your nodejs has successfully deployed.
On your console, you will see the deployed information:
descriptor: [C:\Users\Nuriq\Desktop\Hackernoon\app.yaml]
source: [C:\Users\Nuriq\Desktop\Hackernoon]
target project: [ivory-studio-387214]
target service: [default]
target version: [main-v1]
target url: [//ivory-studio-387214.lm.r.appspot.com]
target service account: [App Engine default service account]
Now, you can access your app via target url:
//ivory-studio-387214.lm.r.appspot.com