0
0
GCPcloud~5 mins

Why GCP for cloud computing - Why It Works

Choose your learning style9 modes available
Introduction
Cloud computing lets you use computers and storage over the internet instead of your own hardware. Google Cloud Platform (GCP) is one option that offers tools and services to run apps and store data easily and reliably.
When you want to build and run apps without buying physical servers.
When you need to store large amounts of data safely and access it from anywhere.
When you want to use smart tools like machine learning without setting up complex systems.
When you want to save money by paying only for what you use.
When you want to quickly grow your app or website without worrying about hardware limits.
Commands
This command lets you log in to your Google Cloud account from the command line so you can use GCP services.
Terminal
gcloud auth login
Expected OutputExpected
Your browser has been opened to visit: https://accounts.google.com/o/oauth2/auth?... You are now logged in as [your-email@example.com].
This sets the current project to 'my-gcp-project' so all commands run in this project context.
Terminal
gcloud config set project my-gcp-project
Expected OutputExpected
Updated property [core/project].
This creates a virtual machine named 'example-vm' in the specified zone with a medium machine type to run your applications.
Terminal
gcloud compute instances create example-vm --zone=us-central1-a --machine-type=e2-medium
Expected OutputExpected
Created [https://www.googleapis.com/compute/v1/projects/my-gcp-project/zones/us-central1-a/instances/example-vm]. NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS example-vm us-central1-a e2-medium 10.128.0.2 34.68.123.45 RUNNING
--zone - Specifies the location where the VM will run.
--machine-type - Defines the size and power of the VM.
This command lists all virtual machines in your current project so you can check their status and details.
Terminal
gcloud compute instances list
Expected OutputExpected
NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS example-vm us-central1-a e2-medium 10.128.0.2 34.68.123.45 RUNNING
Key Concept

If you remember nothing else, remember: GCP lets you use powerful computers and tools over the internet easily, so you don't need to own or manage hardware.

Common Mistakes
Not setting the project before running commands
Commands may fail or run in the wrong project, causing confusion or errors.
Always run 'gcloud config set project your-project-id' before other commands.
Skipping login with 'gcloud auth login'
You cannot access GCP services without being logged in, so commands will fail.
Run 'gcloud auth login' first to authenticate your account.
Choosing wrong zone or machine type without checking availability
The VM creation can fail if the zone or machine type is not available in your project or region.
Check available zones and machine types with 'gcloud compute zones list' and 'gcloud compute machine-types list --zones=your-zone'.
Summary
Use 'gcloud auth login' to sign in to your Google Cloud account.
Set your project with 'gcloud config set project' to run commands in the right context.
Create virtual machines with 'gcloud compute instances create' to run apps in the cloud.
List your virtual machines with 'gcloud compute instances list' to check their status.