Google Cloud
All the goodness of Google Cloud Platform
1
# add project id to the environment variable
2
export PROJECT_ID=$(gcloud config list --format 'value(core.project)')
Copied!
Build docker images and push to container registry
1
# authentication for docker
2
# from https://cloud.google.com/container-registry/docs/advanced-authentication
3
gcloud auth configure-docker
4
5
# build a docker image locally and push to GCP container registry
6
docker build -t gcr.io/ivikramtiwari/website:latest .
7
gcloud docker -- push gcr.io/omni-daeos-runner/website:latest
8
9
# or just use cloud builds which will automatically store the image in registry
10
gcloud builds submit --timeout 2h --tag gcr.io/ivikramtiwari/website:latest .
11
12
# pull image for usage
13
gcloud docker -- pull gcr.io/ivikramtiwari/website:latest
14
15
# -- (double dashes) are used to pass parameters to docker.
16
# If advanced authentication is set up properly, you can skip using
17
# gcloud docker
18
# and just use
19
# docker
Copied!
VMs
Copy data from VM to Local
Second Tab
1
# copy files from a VM to local
2
gcloud compute scp --recurse my-vm://home/vikramtheone1/my-files/ ./ --zone=us-central1-b
Copied!
BigQuery
De-dupe complete table
Second Tab
1
# this will de-deup data based on all rows matching each other
2
CREATE OR REPLACE TABLE `project.dataset.table`
3
PARTITION BY timestamp
4
AS SELECT DISTINCT * FROM `project.dataset.table`
Copied!
Last modified 5mo ago
Copy link