Google Cloud Platform command line Flashcards
To learn the Google Cloud Platform command line commands
Command to list your projects that are accessible by the active account
gcloud projects list
Command to set the region for your project
gcloud config set compute/region “region name”
where “region name” is us-east1 or us-central1 or europe-west1
Command to set your default project
gcloud config set project myProjects
Command to set the zone for your project
gcloud config set compute/zone “zone name”
where “zone name” is us-central1-c, europe-west1-a
Command to list the zones where the compute service is available (i.e. us-central1-a, us-central1-b, europe-west1-a)
gcloud compute zone list
Command to secure shell into a virtual machine or compute instance
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
Command to list the regions where you can do Cloud Functions (AWS equivalent of Lambdas)
gcloud functions region list
Command to list all the URI (Uniform Resource Identifier) in a zone
gcloud compute zones list –uri
Command to list a project’s DNS info
gcloud dns projects-info describe
Command to provide detailed information about a project
gcloud compute project-info describe –project
Command to list credentialed accounts
gcloud auth list
Command to create a project
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
Command to create a project and also give it a name
gcloud projects create [Project_ID] –name=”myProjectName”
Command to delete a project
gcloud projects delete [Project_ID]
Command to show metadata for a project
gcloud projects describe [Project_ID]
Command to get IAM policies for a project
gcloud projects get-iam-policy [Project_ID]
Command to add an IAM policy binding to the existing IAM policy of a project
gcloud projects add-iam-policy-binding [Project_ID] –member [Member] –role [Role]
Command to remove an IAM policy binding to the existing policy of a project
gcloud project remove-iam-policy-binding [Project_ID] –member=[Member] –role=[Role]
Command to set the IAM policy of a project (the initial step)
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)
Command to update the name of a project
gcloud projects update [Project_ID] –name=”the-new-project-name”
Command to install Stackdriver monitoring agent
curl -sSO https://dl.google.com/cloudagents/install-monitoring-agent.sh