❄️GCP

Compute

Description
Command

Create a Compute Engine instance

gcloud compute instances create [INSTANCE_NAME] --machine-type=[MACHINE_TYPE] --image-project=[IMAGE_PROJECT] --image-family=[IMAGE_FAMILY]

SSH into a Compute Engine instance

gcloud compute ssh [INSTANCE_NAME]

Create a Kubernetes Engine cluster

gcloud container clusters create [CLUSTER_NAME]

Deploy a container to a Kubernetes Engine cluster

kubectl create deployment [DEPLOYMENT_NAME] --image=[IMAGE_NAME]

Scale a Kubernetes Engine deployment

kubectl scale deployment [DEPLOYMENT_NAME] --replicas=[REPLICA_COUNT]

View Kubernetes Engine cluster information

gcloud container clusters describe [CLUSTER_NAME]

Storage

Description
Command

Create a Cloud Storage bucket

gsutil mb gs://[BUCKET_NAME]

Copy files to a Cloud Storage bucket

gsutil cp [LOCAL_FILE_PATH] gs://[BUCKET_NAME]/[REMOTE_FILE_PATH]

Download files from a Cloud Storage bucket

gsutil cp gs://[BUCKET_NAME]/[REMOTE_FILE_PATH] [LOCAL_FILE_PATH]

List objects in a Cloud Storage bucket

gsutil ls gs://[BUCKET_NAME]

Networking

Description
Command

Create a VPC network

gcloud compute networks create [NETWORK_NAME]

Create a firewall rule with the specified name and allows traffic on the specified protocol and port from the specified IP range to instances with the specified tag

gcloud compute firewall-rules create [FIREWALL_RULE_NAME] --allow [PROTOCOL]:[PORT] --source-ranges [IP_RANGE] --target-tags [TAG]

Other

Description
Command

List available GCP projects

gcloud projects list

Set the active GCP project to the one with the given PROJECT_ID

gcloud config set project [PROJECT_ID]

Last updated

Was this helpful?