0% found this document useful (0 votes)
95 views2 pages

Gcloud Cheatsheet

This document is a cheat sheet for GCP gcloud CLI commands, covering various categories such as Project & Configuration, Compute Engine, Cloud Storage, IAM, Kubernetes, App Engine, Cloud Functions, Cloud Pub/Sub, and Billing & APIs. It provides essential commands for tasks like authenticating, creating and managing resources, and configuring services. Each section includes specific commands for actions like creating VMs, managing storage buckets, and deploying applications.

Uploaded by

nitinvarshney
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
95 views2 pages

Gcloud Cheatsheet

This document is a cheat sheet for GCP gcloud CLI commands, covering various categories such as Project & Configuration, Compute Engine, Cloud Storage, IAM, Kubernetes, App Engine, Cloud Functions, Cloud Pub/Sub, and Billing & APIs. It provides essential commands for tasks like authenticating, creating and managing resources, and configuring services. Each section includes specific commands for actions like creating VMs, managing storage buckets, and deploying applications.

Uploaded by

nitinvarshney
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

GCP gcloud CLI Commands Cheat Sheet

1. Project & Configuration


Authenticate gcloud:
gcloud auth login
List current config:
gcloud config list
Set active project:
gcloud config set project [PROJECT_ID]
List projects:
gcloud projects list

2. Compute Engine (VMs)


Create VM:
gcloud compute instances create [INSTANCE_NAME] --zone=[ZONE] --machine-type=[TYPE]
--image-family=[FAMILY] --image-project=[PROJECT]
List VMs:
gcloud compute instances list
Delete VM:
gcloud compute instances delete [NAME]
SSH to VM:
gcloud compute ssh [INSTANCE_NAME]

3. Cloud Storage
Create bucket:
gcloud storage buckets create gs://[BUCKET_NAME] --location=[REGION]
Upload file:
gcloud storage cp [LOCAL_FILE] gs://[BUCKET_NAME]/
List buckets:
gcloud storage ls
Delete file:
gcloud storage rm gs://[BUCKET_NAME]/[FILE]

4. IAM
Add IAM policy:
gcloud projects add-iam-policy-binding [PROJECT_ID] --member='user:[EMAIL]' --role='roles/viewer'
Create service account:
gcloud iam service-accounts create [NAME] --display-name='[DESCRIPTION]'
List roles:
gcloud iam roles list

5. Kubernetes (GKE)
Create GKE cluster:
gcloud container clusters create [CLUSTER_NAME] --zone=[ZONE] --num-nodes=3
Get credentials:
gcloud container clusters get-credentials [CLUSTER_NAME] --zone=[ZONE]
List pods:
kubectl get pods

6. App Engine
Create app:
gcloud app create --region=[REGION]
Deploy app:
gcloud app deploy
Open app:
gcloud app browse

7. Cloud Functions
Deploy function:
gcloud functions deploy [NAME] --runtime=[RUNTIME] --trigger-http --allow-unauthenticated
List functions:
gcloud functions list

8. Cloud Pub/Sub
Create topic:
gcloud pubsub topics create [TOPIC_NAME]
Create subscription:
gcloud pubsub subscriptions create [SUB_NAME] --topic=[TOPIC_NAME]

9. Billing & APIs


Enable API:
gcloud services enable compute.googleapis.com
List billing accounts:
gcloud billing accounts list

You might also like