How to install Google Cloud SDK and Configure for Google Cloud Platform
(GCP).
- Get access to https://console.cloud.google.com by getting a free tier account activated with your google account and a valid credit card.
-
- Google Cloud SDK is a command-line interface for controlling Google Cloud Platform products and services.
-
- Download the file GoogleCloudSDKInstaller.exe from https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe (For Windows Platform) . For other platforms, please refer to https://cloud.google.com/sdk/
- Once downloaded double-click the installer executable file from downloads folder and complete the installation.
- Hold on folks, we are not done with the job yet.!!
- Now configure the cloud SDK installer for google using gcloud init console command, similar to below one:
-
- Test the working of gcloud CLI by the command below:
- gcloud compute images list /*To list the operating System images available by default in GCP */
- gcloud compute zones list
/*To list the availability zones available by default in GCP */ - gcloud compute instances create demo-jenkins-instance-1 --image-project centos-cloud --image centos-7-v20190423 --machine-type n1-standard-1 --zone asia-northeast1-a /* To create an instance in gcp by passing relevant parameters */
- gcloud compute instances describe <instance name> /*To check for existing instance in gcp, use the command similar to below*/
- Sample Output
-
canIpForward: false
cpuPlatform: Intel Haswell
creationTimestamp: '2019-03-16T04:33:56.843-07:00'
deletionProtection: false
description: ''disks:- autoDelete: trueboot: truedeviceName: demo-tomcat-instance-1index: 0interface: SCSIkind: compute#attachedDisklicenses:- https://www.googleapis.com/compute/v1/projects/centos-cloud/global/licenses/centos-7mode: READ_WRITEsource: https://www.googleapis.com/compute/v1/projects/subtle-poet-231812/zones/us-east1-b/disks/demo-tomcat-instance-1type: PERSISTENTid: '7314555617687986636'kind: compute#instancelabelFingerprint: 42WmSpB8rSM=machineType: https://www.googleapis.com/compute/v1/projects/subtle-poet-231812/zones/us-east1-b/machineTypes/n1-standard-1metadata:fingerprint: sKpdoLSMkQ8=kind: compute#metadataname: demo-tomcat-instance-1networkInterfaces:- accessConfigs:- kind: compute#accessConfigname: External NATnatIP: 34.73.246.154networkTier: PREMIUMtype: ONE_TO_ONE_NATfingerprint: mlzggKQryXg=kind: compute#networkInterfacename: nic0network: https://www.googleapis.com/compute/v1/projects/subtle-poet-231812/global/networks/defaultnetworkIP: 10.142.0.5subnetwork: https://www.googleapis.com/compute/v1/projects/subtle-poet-231812/regions/us-east1/subnetworks/defaultscheduling:automaticRestart: trueonHostMaintenance: MIGRATEpreemptible: falseselfLink: https://www.googleapis.com/compute/v1/projects/subtle-poet-231812/zones/us-east1-b/instances/demo-tomcat-instance-1serviceAccounts:- email: 443849179644-compute@developer.gserviceaccount.comscopes:- https://www.googleapis.com/auth/devstorage.read_only- https://www.googleapis.com/auth/logging.write- https://www.googleapis.com/auth/monitoring.write- https://www.googleapis.com/auth/servicecontrol- https://www.googleapis.com/auth/service.management.readonly- https://www.googleapis.com/auth/trace.appendstartRestricted: falsestatus: RUNNINGtags:fingerprint: 42WmSpB8rSM=zone: https://www.googleapis.com/compute/v1/projects/subtle-poet-231812/zones/us-east1-b- >gcloud compute instances create demo-jenkins-instance-1 --image-project centos-cloud --image centos-7-v20190423 --machine-type n1-standard-1 --zone asia-northeast1-a
- >gcloud compute instances create demo-ansible-instance-1 --image-project centos-cloud --image centos-7-v20190423 --machine-type n1-standard-1 --zone asia-northeast1-a
Please feel free to add in comments if you face any difficulties. I will be happy to help you.