• Stars
    star
    110
  • Rank 316,770 (Top 7 %)
  • Language
  • Created about 6 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

☁️ GCP gcloud, gsutil, etc.

1 GCP CheatSheet

linkedin
github
slack


PRs Welcome

File me Issues or star this repo.

1.1 GCP Basic

NameSummary
Official DocLink: gcloud reference, Link: gsutil tool
gsutil installationLink: install crcmod, Link: Install gsutil
InstallationLink: Install gcloud
Check version & settingsgcloud version, gcloud info, gcloud components list
Init profilegcloud init This will ask you to open an OpenID URL
List all zonesgcloud compute zones list
Upgrade local SDKgcloud components update, gcloud components update --version 219.0.1

1.2 Bucket Basic

NameSummary
List all buckets and filesgsutil ls, gsutil ls -lh gs://<bucket-name>
Download filegsutil cp gs://<bucket-name>/<dir-path>/package-1.1.tgz .
Upload filegsutil cp <filename> gs://<bucket-name>/<directory>/
Cat filegsutil cat gs://<bucket-name>/<filepath>/
Delete filegsutil rm gs://<bucket-name>/<filepath>
Move filegsutil mv <src-filepath> gs://<bucket-name>/<directory>/<dest-filepath>
Copy foldergsutil cp -r ./conf gs://<bucket-name>/
Show disk usagegsutil du -h gs://<bucket-name/<directory>
Create bucketgsutil mb gs://<bucket-name>
Caculate file sha1sumgsha1sum syslog-migration-10.0.2.tgz, shasum syslog-migration-10.0.2.tgz
Gsutil helpgsutil help, gsutil help cp, gsutil help options
ReferenceLink: Quickstart: Using the gsutil Tool

1.3 GCP Project

NameSummary
List projectsgcloud config list, gcloud config list project
Show project infogcloud compute project-info describe
Switch projectgcloud config set project <project-id>

1.4 GKE

NameSummary
Display a list of credentialed accountsgcloud auth list
Set the active accountgcloud config set account <ACCOUNT>
Set kubectl contextgcloud container clusters get-credentials <cluster-name>
Change regiongcloud config set compute/region us-west
Change zonegcloud config set compute/zone us-west1-b
List all container clustersgcloud container clusters list

1.5 IAM

NameSummary
Authenticate clientgcloud auth activate-service-account --key-file <key-file>
Display a list of credentialed accountsgcloud auth list
Set the active accountgcloud config set account <ACCOUNT>
Auth to GCP Container Registrygcloud auth configure-docker
Print token for active accountgcloud auth print-access-token, gcloud auth print-refresh-token
Revoke previous generated credentialgcloud auth <application-default> revoke

1.6 Bucket Security

NameSummary
Make all files readablegsutil -m acl set -R -a public-read gs://<bucket-name>/
Config authgsutil config -a
Grant bucket accessgsutil iam ch user:[email protected]:objectCreator,objectViewer gs://<bucket-name>
Remove bucket accessgsutil iam ch -d user:[email protected]:objectCreator,objectViewer gs://<bucket-name>

1.7 VM

NameSummary
List all instancesgcloud compute instances list, gcloud compute instance-templates list
Show instance info=gcloud compute instances describe “<instance-name>” –project “<project-name>” –zone “us-west2-a”=
Stop an instancegcloud compute instances stop instance-2
Start an instancegcloud compute instances start instance-2
Create an instancegcloud compute instances create vm1 --image image-1 --tags test --zone "<zone>" --machine-type f1-micro
SSH to instance=gcloud compute ssh –project “<project-name>” –zone “<zone-name>” “<instance-name>”=
Download filesgcloud compute copy-files example-instance:~/REMOTE-DIR ~/LOCAL-DIR --zone us-central1-a
Upload filesgcloud compute copy-files ~/LOCAL-FILE-1 example-instance:~/REMOTE-DIR --zone us-central1-a

1.8 Disks & Volumes

NameSummary
List all disksgcloud compute disks list
List all disk typesgcloud compute disk-types list
List all snapshotsgcloud compute snapshots list
Create snapshotgcloud compute disks snapshot <diskname> --snapshotname <name1> --zone $zone

1.9 Network

NameSummary
List all networksgcloud compute networks list
Detail of one networkgcloud compute networks describe <network-name> --format json
Create networkgcloud compute networks create <network-name>
Create subnetgcloud compute networks subnets create subnet1 --network net1 --range 10.5.4.0/24
Get a static ipgcloud compute addresses create --region us-west2-a vpn-1-static-ip
List all ip addressesgcloud compute addresses list
Describe ip addressgcloud compute addresses describe <ip-name> --region us-central1
List all routesgcloud compute routes list
Referencealeccunningham gist: vpn-setup.sh

1.10 DNS

NameSummary
List of all record-sets in my_zonegcloud dns record-sets list --zone my_zone
List first 10 DNS recordsgcloud dns record-sets list --zone my_zone --limit=10

1.11 Firewall

NameSummary
List all firewall rulesgcloud compute firewall-rules list
List all forwarding rulesgcloud compute forwarding-rules list
Describe one firewall rulegcloud compute firewall-rules describe <rule-name>
Create one firewall rulegcloud compute firewall-rules create my-rule --network default --allow tcp:9200 tcp:3306
Update one firewall rulegcloud compute firewall-rules update default --network default --allow tcp:9200 tcp:9300

1.12 Images & Containers

NameSummary
List all imagesgcloud compute images list
List all container clustersgcloud container clusters list
Set kubectl contextgcloud container clusters get-credentials <cluster-name>

1.13 RDS

NameSummary
List all sql instancesgcloud sql instances list

1.14 Services

NameSummary
List my backend servicesgcloud compute backend-services list
List all my health check endpointsgcloud compute http-health-checks list
List all URL mapsgcloud compute url-maps list

1.15 More Resources

kelseyhightower gist: create-global-lb.sh

mingderwang gist: gistfile1.txt

License: Code is licensed under MIT License.

linkedin github slack

More Repositories

1

cheatsheet-kubernetes-A4

📖 Kubernetes CheatSheets In A4
Shell
1,851
star
2

cheatsheet.dennyzhang.com

Apply best practices via CheatSheets
Shell
649
star
3

kubernetes-yaml-templates

Kubernetes Yaml Templates
594
star
4

cheatsheet-jenkins-groovy-A4

📖 Groovy CheatSheet For Jenkins Usage In A4
Groovy
325
star
5

challenges-kubernetes

☁️ Challenges Your Kubernetes Skills And Knowledge
Shell
230
star
6

devops_public

🎩 DevOps Scripts
Shell
179
star
7

cheatsheet-python-A4

📖 Advanced Python Syntax In A4
Python
100
star
8

code.dennyzhang.com

❓ Algorithms & Coding Problems
CSS
95
star
9

cheatsheet-docker-A4

📖 Docker CheatSheets In A4
Dockerfile
90
star
10

monitor-docker-slack

⏰ Get Slack Notifications, When Containers Run Into Issues
Python
71
star
11

challenges-cloudformation-jenkins

🏫 Challenges Your AWS And Cloudformation Skills By Solving Real Questions.
Shell
60
star
12

cheatsheet-golang-A4

📖 Advanced Golang Syntax In A4
Go
56
star
13

prepare-k8s-cka

📖 Preparation For Kubernetes CKA/CKAD Exam
51
star
14

cheatsheet-aws-A4

☁️ AWS CheatSheets In A4
48
star
15

cheatsheet-paper-A4

https://cheatsheet.dennyzhang.com/cheatsheet-paper-A4
46
star
16

Denny-s-emacs-configuration

🤖 Emacs shapes me to be a better programmer
Emacs Lisp
41
star
17

kubernetes-scripts

Handy kubernetes scripts for common scenarios
Shell
37
star
18

challenges-chef

📖 Challenges Your Chef Skills By Solving Real Questions.
Ruby
26
star
19

cheatsheet-git-A4

CheatSheet For Git & GitHub
25
star
20

developer-free-saas

🕸️ A curated list Of Free Web-based Tools For Developers
Shell
23
star
21

devops_jenkins

🤖 VisualOps via Jenkins jobs
21
star
22

architect.dennyzhang.com

☝️ Learn system design in a solid way
Shell
21
star
23

cheatsheet-tmux-A4

tmux/tmate Usage in A4
20
star
24

cheatsheet-vim-A4

Vim usage and personal knowledge base
18
star
25

cheatsheet-pks-A4

CheatSheet For PKS: Pivotal Kubernetes Service
Shell
16
star
26

popular-github-template

📗 Repo Template: Make Your GitHub Repos More Popular
16
star
27

cheatsheet-shell-A4

🏫 Examine your shell skills
Shell
16
star
28

xiaozibao

Your personal magzine, adjusted by your taste.
Objective-C
13
star
29

python-selenium

Use Python Selenium For GUI Automation Test
Python
11
star
30

cheatsheet-bosh-A4

📖 CheatSheet For CloudFoundry Bosh
Shell
10
star
31

remote-commands-servers

👪 Run remote ssh commands on multiple servers
Python
9
star
32

monitoring

Checks for various monitoring
Shell
9
star
33

chatops_slack

🚀 Python Slack ChatOps
Python
7
star
34

elasticsearch-cli-tool

🏪 CLI tools for ealsticsearch
Python
6
star
35

developer-technical-selling

💵 Do a better technical selling as a developer
5
star
36

linkedin-grow-influence

🔌 How To Improve Professional Influence In Linkedin
5
star
37

challenges-k8s-monitoring

Notes for deep dive into Kubernetes monitoring
5
star
38

cheatsheet-emacs-A4

📖 Emacs lisp cheatsheet
Emacs Lisp
5
star
39

challenges-aws-ecs

✍️ Case study using AWS ECS to setup personal wordpress
PHP
5
star
40

challenges-k8s-crd

Kubernets CRD: extend k8s resource
Dockerfile
4
star
41

cheatsheet-ruby-A4

📖 Advanced Ruby Syntax In A4
4
star
42

detect_suspicious_process

Detect suspicious process
Python
4
star
43

directory-cli-tool

📁 CLI tools for directories
Shell
3
star
44

python-hosts-tool

📍 Manage /etc/hosts in an organized way by Python
Python
3
star
45

code-with-docker

Use docker to write code in different languages
Shell
3
star
46

www.dennyzhang.com

Personal blog: DevOps, Cloud, Life
Shell
3
star
47

challenges-k8s-logging

Notes for deep dive into Kubernetes logging
3
star
48

challenges-k8s-storage

Notes for deep dive into Kubernetes storage
3
star
49

maintain-github-repos

👪 KnowledgeBase: Grow Influence From Maintaining Github Projects
3
star
50

maintain-it-blog

📚 Be a better IT Blogger
3
star
51

chef_community_cookbooks

🍖 Chef cookbooks for devops
Python
3
star
52

nmap-scan-docker

nmap network scan via docker
Python
3
star
53

shadowsocks-vpn-docker

🏗️ Docker shadowsocks VPN
Shell
2
star
54

dennytest

Github Repo to host various test scripts
Go
2
star
55

jenkins_image

💂‍♂️ Jenkins Docker Image
Shell
2
star
56

my-slides

Host my slides: devops, kubernetes, life, etc
2
star
57

cleanup_old_files

Clean old files in an organized way
Python
2
star
58

terraform_jenkins_digitalocean

Define Jenkins job to create and provision digitalocean VMs by terraform
Shell
2
star
59

python-aws-cli-wrapper

☁️ Wrapper layer of AWS CLI in Python
Python
2
star
60

cheatsheet-living-in-ca

👪 CheatSheet for living in Canifornia
2
star
61

quiz.dennyzhang.com

📖 Examine skills in a hard way
Shell
1
star
62

dennyzhang.github.io

dummy website
1
star
63

check_logfiles

nagios plugin to check log files
Perl
1
star
64

book-reading-cloud

📖 My book reading to be a good cloud engineer/architect
1
star
65

couchbase-cli-tool

Couchbase CLI Tools
Python
1
star
66

node_status_in_json

Query node status and return a structured json
Python
1
star
67

challenges-fluent-bit

Deep dive into fluent-bit
1
star
68

today-learning

Personal memo for #today-learnings in our DevOps slack group
1
star