Interact with Google Cloud using Google Cloud Console, Cloud SDK and Cloud Shell
In this article we will learn how to interact with Google Cloud using Google Cloud Console, Cloud SDK and Cloud Shell.
A project is a key organizational component of Google Cloud Platform (GCP), allowing you to control and separate your cloud resources.
Resource isolation, access control, and billing administration are features that projects in GCP provide, enabling businesses to efficiently organize and secure their cloud resources. They offer a logical barrier for organizing infrastructure and allow for precise management of resource allotment and permissions.
The equivalent of a project in GCP in AWS is a “AWS Account” or “AWS Organization,” which acts as a hub for resource management, billing, and access control.
A “Resource Group,” which serves as a logical container for organizing and managing resources, access control, and invoicing within an Azure subscription, is the comparable notion in Azure to a project in GCP.
We can interact with Google Cloud service using Google Cloud Console, Cloud SDK, Cloud APIs, Cloud Client Libraries, Cloud Shell, and third-party tools.
In this article we will learn how to interact with GCP services using Google Cloud Console, Cloud SDK and Cloud Shell.
Interacting using Google Cloud Console
For managing your Google Cloud projects, you can utilize the Google Cloud console, which offers a web-based graphical user interface.
You can choose an existing project to work on while using the Cloud Console, or you can create a new one.
The resources you produced inside that project’s context may then be configured from there.
Interacting using Google Cloud Console
In below example we will create project named my-gui-project-1 using Google Cloud Console –
Login via https://console.cloud.google.com/
IAM and Admin > Create Project
Enter project name and project-id
We can see that the project is created -
Interacting using Google Cloud Shell
A browser may be used to access Cloud Shell, an online development and operations environment, from any location. With its online terminal, which comes pre-installed with tools like the gcloud command-line tool, kubectl, and more, you can manage your resources. Using the online Cloud Shell Editor, you can also create, build, test, and deploy your cloud-based applications.
How to access google cloud shell?
Login in google cloud console using –
After login we can see shell icon. Click on shell to activate cloud shell.
When we click on cloud shell, for temporary use, Cloud Shell creates a Compute Engine virtual machine running the Linux operating system Debian. Because it is owned and managed by Google Cloud, this virtual machine won’t show up in any of your GCP projects. It will ask you to continue.
We can see that it has started provisioning shell. Once cloud shell machine is provisioned, we can create “project-10112” using gcloud sdk/cli.
$ gcloud projects create project-1002-id
When prompted click on Authorize.
Output
devops@cloudshell:~$ gcloud projects create project-1002-id
Create in progress for [https://cloudresourcemanager.googleapis.com/v1/projects/project-1002-id].
Waiting for [operations/cp.6413245443463820174] to finish…done.
Enabling service [cloudapis.googleapis.com] on project [project-1002-id]…Operation "operations/acat.p2–955702361801–9acf2d33-f2ea-42b2–8657-c24c949bd0a6" finished successfully.
List project
$ gcloud projects list | grep project-10112
Output
devops@cloudshell:~$ gcloud projects list | grep project-1002-id
PROJECT_ID: project-1002-id
NAME: project-1002-id
devops@cloudshell:~$
Interacting using Google Cloud SDK- gcloud cli
You may set up Cloud SDK on your computer. The gcloud tool is part of the SDK, allowing you to launch a terminal window on your personal computer and provide instructions to control Google Cloud services.
Install Cloud SDK on your machine or any other VM –
# Download -
$ curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-437.0.1-linux-x86_64.tar.gz
# Extract -
$ tar -xf google-cloud-cli-437.0.1-linux-x86.tar.gz
$ ./google-cloud-sdk/install.sh
$ ./google-cloud-sdk/bin/gcloud init
#Set path -
$ export PATH="./google-cloud-sdk/bin/gcloud/bin:$PATH" to .bashrc
#Set the properties -
gcloud config set project <project-id>
gcloud config set compute/zone europe-west1-b
#Authorizing SDK -
gcloud auth login
#Authorize with a service account -
gcloud auth activate-service-account
I hope you found this article useful in some way. I will be back with some more articles on Cloud and DevOps soon.