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
Q

Command to provide information about a deployment

A

gcloud deployment-manager deployments describe [Deployment_Name]

26
Q

Command to list deployments associated with the current project

A

gcloud deployment-manager deployments list

27
Q

Command to stop a currently running or pending operation on a deployment

A

gcloud deployment-manager deployments stop [Deployment_Name]

28
Q

Command to update a deployment with new configuration information

A

gcloud deployment-manager deployments update [Deployment_Name] –config new_config_file.yaml

29
Q

Command to reserve an IP address for your project

A

gcloud compute addresses create [name for address] –addresses [XX.XXX.XXX.XXX (the IP address you want)]

30
Q

Command to get info on an IP address for your project

A

gcloud compute address describe [name of address]

31
Q

Command to list IP address of your project

A

gcloud compute addresses describe

32
Q

Command to create disks

A

gcloud compute disks create [Disk_Name] –zone us-east1-a

33
Q

Gcloud disk commands

A

gcloud compute disks [command]

command can be create, delete, describe, list, move, resize, snapshot, update

34
Q

Gcloud firewall rules commands

A

gcloud compute firewall-rules [command]

command can be create, delete, update, list, describe

35
Q

Gcloud health-checks commands

A

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
Q

Gcloud image related commands

A

gcloud compute images [command]

command can be create, delete, update, list, describe, add-labels, remove-labels, export, import

37
Q

Gcloud instance template related commands

A

gcloud compute instance-templates [command]

command can be create, delete, list, describe

38
Q

Gcloud instance related commands

A

gcloud compute instances [command]

command can be create delete, list, describe, start, stop, move, update, update-container

39
Q

Gcloud commands to get project information

A

gcloud compute project-info [command]

command can be describe, update, add-metadata, remove-metadata, set-usage-bucket

40
Q

Gcloud region commands

A

gcloud compute region [command]

command can be describe or list

41
Q

Gcloud snapshot commands

A

gcloud compute snapshot [command]

command can be delete, describe, list, update, add-labels, remove-labels

42
Q

Gcloud configuration commands

A

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
Q

Gcloud builds commands

A

gcloud builds [command]

commands can be cancel, describe, list, log submit

44
Q

Gcloud clusters commands

A

gcloud container clusters [command]

command can be create, delete, describe, get-credentials, list, resize update, upgrade

45
Q

Gcloud node pool commands

A

gcloud container node-pools [command]

command can be create, delete, describe, list, rollback, update

46
Q

Gcloud container operations commands

A

gcloud container operations [command]

command can be describe, list, wait

47
Q

Gcloud container registry commands

A

gcloud container images [command]

command can be add-tag, delete, describe, list, list-tags, untag

48
Q

Gcloud IAM roles commands

A

gcloud iam roles [command]

command can be copy, create, delete, describe, list, undelete, update

49
Q

Gcloud IAM service account commands

A

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
Q

Kubernetes commands to create a pod with a yaml configuration file

A

kubectl create -f podinfo.yaml

51
Q

Kubernetes command to get info about a resource

A

kubectl get [resource type]

resource type can be pods, deployment, replicationcontroler

52
Q

Kubernetes command to create and run an image

A

kubectl run [name] –image=[image name]

53
Q

Kubernetes command to expose a resource to a new Kubernetes service

A

kubectl expose [resource type] [resource name]

example:
kubectl expose pod valid-pod –port=444 –name=frontend

54
Q

Kubernetes command to delete a resource

A

kubectl delete [resource] [resource name]

example: deletes pods and services with the label “myLabel”
kubectl delete pods,services -l name=myLabel