Skip to main content

GCP Getting Started


Let's automatically generate the infrastructure code of resources living on the Google Cloud Platform.


GCP Account#

Access to the GCP console is required to run this tutorial.


Ensure the GCP CLI called gcloud is installed:

$ gcloud -v
Google Cloud SDK 318.0.0
beta 2020.11.06
bq 2.0.62
core 2020.11.06
gsutil 4.54

Initialise gcloud#

Initialize gcloud in order to authenticate your user, as well and setting the default region and zone:

gcloud init

Check the config at any time with:

gcloud config list


GruCloud is written in Javascript running on Node.js

Verify the presence of node and check the version:

node --version

Any version above 14 should be fine.

GruCloud CLI#

The GruCloud CLI called gc can be installed globally with NPM:

npm i -g @grucloud/core

As a sanity check, display the version with:

gc --version

That's all for these requirements.

### Create new project

gc new

Select GCP and choose a project.


A few actions need to be performed prior to deploying the resources.

  • Create the project
  • Setup billing for that project
  • Enable the API services
  • Create a service account
  • Create and save the credential file for this service account
  • Update the IAM policy by binding roles to the service account

Don't worry, these preparations steps are fully automated:

gc init

Code Generation#

Here we assume some resources are already deployed.

gc gencode

This command fetches the resources inventory and generated the code in resource.js.

Congratulation, the infrastructure code has been created automatically.


To destroy the infrastructure, use the destroy command:

gc destroy

Next Steps#