Skip to content

Google Cloud Platform

gcloud

Adding repo

deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main

To be saved in /etc/yum.repos.d/google-cloud-sdk.repo

[google-cloud-sdk]
name=Google Cloud SDK
baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=0
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
    https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg

Initialize

gcloud init

In GCP, APIs are enabled per project.

List all APIs

# Enabled APIs only
gcloud services list 

# Including disabled APIs
gcloud services list --available

Enable API

gcloud services enable compute.googleapis.com container.googleapis.com

Display all available regions and zones

gcloud compute regions list
gcloud compute zones list

Set default region and zone

gcloud config set compute/region us-east1 # Moncks Corner, South Carolina
gcloud config set compute/zone us-east1-c

Storage

Create disk
gcloud compute disks create my-disk --size=10GB --zone=us-east1-b