Google Cloud Platform command line Flashcards

To learn the Google Cloud Platform command line commands

1
Q

Command to list your projects that are accessible by the active account

A

gcloud projects list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Command to set the region for your project

A

gcloud config set compute/region “region name”

where “region name” is us-east1 or us-central1 or europe-west1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Command to set your default project

A

gcloud config set project myProjects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Command to set the zone for your project

A

gcloud config set compute/zone “zone name”

where “zone name” is us-central1-c, europe-west1-a

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Command to list the zones where the compute service is available (i.e. us-central1-a, us-central1-b, europe-west1-a)

A

gcloud compute zone list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Command to secure shell into a virtual machine or compute instance

A

gcloud compute ssh “virtual-machine-name”

You can’t have spaces in the name so you must have it all one word or put dashes in

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Command to list the regions where you can do Cloud Functions (AWS equivalent of Lambdas)

A

gcloud functions region list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Command to list all the URI (Uniform Resource Identifier) in a zone

A

gcloud compute zones list –uri

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Command to list a project’s DNS info

A

gcloud dns projects-info describe

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Command to provide detailed information about a project

A

gcloud compute project-info describe –project

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Command to list credentialed accounts

A

gcloud auth list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Command to create a project

A

gcloud projects create [Project_ID]

Project_ID is different from the Project Name. It can’t be changed but is still basically just a name with letters and numbers between 6 and 30 characters long

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Command to create a project and also give it a name

A

gcloud projects create [Project_ID] –name=”myProjectName”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Command to delete a project

A

gcloud projects delete [Project_ID]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Command to show metadata for a project

A

gcloud projects describe [Project_ID]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Command to get IAM policies for a project

A

gcloud projects get-iam-policy [Project_ID]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Command to add an IAM policy binding to the existing IAM policy of a project

A

gcloud projects add-iam-policy-binding [Project_ID] –member [Member] –role [Role]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Command to remove an IAM policy binding to the existing policy of a project

A

gcloud project remove-iam-policy-binding [Project_ID] –member=[Member] –role=[Role]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Command to set the IAM policy of a project (the initial step)

A

gcloud projects set-iam-policy [Project_ID] [Policy_File]

Policy_File is the YAML or JSON file that contains all of your IAM settings (the policy)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Command to update the name of a project

A

gcloud projects update [Project_ID] –name=”the-new-project-name”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Command to install Stackdriver monitoring agent

A

curl -sSO https://dl.google.com/cloudagents/install-monitoring-agent.sh

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Command to install Stackdriver logging agent

A

curl -sSO https://dl.google.com/cloudagents/install-logging-agent.sh

23
Q

Command to create a deployment

A

gcloud deployment-manager deployments create [Deployment_Name] –config configfile.yaml –description “MyDeployment”

The –config and –description flags are optional

24
Q

Command to delete a deployment

A

gcloud deployment-manager deployments delete [Deployment_Name]

25
Command to provide information about a deployment
gcloud deployment-manager deployments describe [Deployment_Name]
26
Command to list deployments associated with the current project
gcloud deployment-manager deployments list
27
Command to stop a currently running or pending operation on a deployment
gcloud deployment-manager deployments stop [Deployment_Name]
28
Command to update a deployment with new configuration information
gcloud deployment-manager deployments update [Deployment_Name] --config new_config_file.yaml
29
Command to reserve an IP address for your project
gcloud compute addresses create [name for address] --addresses [XX.XXX.XXX.XXX (the IP address you want)]
30
Command to get info on an IP address for your project
gcloud compute address describe [name of address]
31
Command to list IP address of your project
gcloud compute addresses describe
32
Command to create disks
gcloud compute disks create [Disk_Name] --zone us-east1-a
33
Gcloud disk commands
gcloud compute disks [command] command can be create, delete, describe, list, move, resize, snapshot, update
34
Gcloud firewall rules commands
gcloud compute firewall-rules [command] command can be create, delete, update, list, describe
35
Gcloud health-checks commands
gcloud compute health-checks [command] command can be create, delete, update, list, describe create and update can also have protocols with them gcloud compute health-checks create [protocol] protocol can be http, https, ssl, and tcp
36
Gcloud image related commands
gcloud compute images [command] command can be create, delete, update, list, describe, add-labels, remove-labels, export, import
37
Gcloud instance template related commands
gcloud compute instance-templates [command] command can be create, delete, list, describe
38
Gcloud instance related commands
gcloud compute instances [command] command can be create delete, list, describe, start, stop, move, update, update-container
39
Gcloud commands to get project information
gcloud compute project-info [command] command can be describe, update, add-metadata, remove-metadata, set-usage-bucket
40
Gcloud region commands
gcloud compute region [command] command can be describe or list
41
Gcloud snapshot commands
gcloud compute snapshot [command] command can be delete, describe, list, update, add-labels, remove-labels
42
Gcloud configuration commands
gcloud config [command] command can be get-value, list, set, unset It can also be configurations [subcommand] where subcommand is activate, create, delete, describe, list
43
Gcloud builds commands
gcloud builds [command] commands can be cancel, describe, list, log submit
44
Gcloud clusters commands
gcloud container clusters [command] command can be create, delete, describe, get-credentials, list, resize update, upgrade
45
Gcloud node pool commands
gcloud container node-pools [command] command can be create, delete, describe, list, rollback, update
46
Gcloud container operations commands
gcloud container operations [command] command can be describe, list, wait
47
Gcloud container registry commands
gcloud container images [command] command can be add-tag, delete, describe, list, list-tags, untag
48
Gcloud IAM roles commands
gcloud iam roles [command] command can be copy, create, delete, describe, list, undelete, update
49
Gcloud IAM service account commands
gcloud iam service-accounts [command] command can be create, delete, describe, list, update, add-iam-policy-binding, remove-iam-policy-binding, set-iam-policy, sign-blob
50
Kubernetes commands to create a pod with a yaml configuration file
kubectl create -f podinfo.yaml
51
Kubernetes command to get info about a resource
kubectl get [resource type] resource type can be pods, deployment, replicationcontroler
52
Kubernetes command to create and run an image
kubectl run [name] --image=[image name]
53
Kubernetes command to expose a resource to a new Kubernetes service
kubectl expose [resource type] [resource name] example: kubectl expose pod valid-pod --port=444 --name=frontend
54
Kubernetes command to delete a resource
kubectl delete [resource] [resource name] example: deletes pods and services with the label "myLabel" kubectl delete pods,services -l name=myLabel