Skip to content

Latest commit

 

History

History
105 lines (74 loc) · 1.9 KB

CHEATSHEET.md

File metadata and controls

105 lines (74 loc) · 1.9 KB

Google Cloud Platform (GCP) Cheatsheet

Environment Variables

$ echo "$DEVSHELL_PROJECT_ID"

Regions and Zones

# list all zones
$ gcloud compute zones list

COMPUTE

Cloud Functions

# create and deploy function
$ gcloud functions deploy <FUNCTION-NAME> \
  --stage-bucket=<STAGE-BUCKET> \
  --trigger-topic=<TRIGGER-TOPIC> \
  --runtime=<RUNTIME>

# verify status of function
$ gcloud functions describe <FUNCTION-NAME>

# create test of function
$ gcloud functions call <FUNCTION-NAME> --data <DATA>

# check logs in the log history
$ gcloud functions logs read <FUNCTION-NAME>

STORAGE

Cloud Storages

# list all buckets
$ gsutil ls

# upload file
$ gsutil cp <FILE_NAME> gs://<BUCKET_NAME>/<DIR_PATH>/

# delete file
$ gsutil rm gs://<BUCKET_NAME>/<FILE_PATH>

# download file
$ gsutil cp gs://<BUCKET_NAME>/<FILE_PATH> .

# move file
$ gsutil mv <SRC_FILE_PATH> gs://<BUCKET_NAME>/<DEST_FILE_PATH>

DATABASES

NETWORKING

OPERATIONS

BIG DATA

BigQuery

# list any existing datasets in our project
$ bq ls

# create dataset
$ bq mk <DATASET_NAME>

# remove dataset
$ bq rm -r <DATASET>

# create or update table and load data
$ bq load <DATASET:TABLE> <FILE> <SCHEMA>

# check the schema of given table
$ bq show <DATASET:TABLE>

# examing schema of given table
$ bq show <PROJECT>:<DATASET.TABLE>

# run query
$ bq query "[SQL_STATEMENT]"

References