-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathgcloud_commands.sh
More file actions
78 lines (44 loc) · 2.11 KB
/
gcloud_commands.sh
File metadata and controls
78 lines (44 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# These are
# https://cloud.google.com/sdk/docs/quickstarts
# https://cloud.google.com/sdk/docs/components
$ lscpu
$ free -m
$ lsblk
$ cat /etc/*release*
$ mkdir /opt/batch11 # this is ephemeral, means it will be gone after the restart of the shell
# Where is cloud shell provisioned ??
# https://www.google.com/about/datacenters/
gcloud init
gcloud info
gcloud version
gcloud auth list
gcloud config list
gcloud auth login
gcloud auth revoke
gcloud projects list
gcloud compute instances create gcloudinstance
#https://cloud.google.com/sdk/gcloud/reference/config/configurations/create
gcloud config list
gcloud config get-value project
gcloud config set project <PROJECT_ID>
gcloud config set compute/zone us-east1
gcloud config unset compute/zone
gcloud config configurations list
gcloud config configurations create prod --no-activate
gcloud config list --configuration dev-data
gcloud components list
# Firewall commands
### gcloud commands to create a network , subnet and 3 virtual machines
* gcloud compute networks create custom-network --subnet--mode custom
* gcloud compute networks subnets create subnet-a --network=custom-network --region=us-central1 --range=10.2.1.0/24
* gcloud compute networks subnets create subnet-b --network=custom-network --region=us-central1 --range=10.2.2.0/24
* gcloud compute instances create instance-1a --zone=us-central1-a --machine-type=f1-micro --subnet=subnet-a
* gcloud compute instances create instance-1b --zone=us-central1-a --machine-type=f1-micro --subnet=subnet-a --no-address
* gcloud compute instances create instance-1c --zone=us-central1-a--machine-type=f1-micro --subnet=subnet-a
* gcloud compute instances create instance-2 --zone=us-central1-a --machine-type=f1-micro --subnet=subnet-b
* gcloud compute instances create instance-3 --zone=us-central1-a --machine-type=f1-micro --subnet=subnet-b --no-address
# TO get IAM across ORG
gcloud organizations list
# you will get ORGANIZATION_ID
# then use the below command
gcloud organizations get-iam-policy ORGANIZATION_ID --flatten="bindings[].members" --format="table(bindings.members,bindings.role)" --filter "user"