Compute Engine
Run virtual machines in Google's data centres
To check for the defaults
gcloud compute project-info describe --project <your_project_ID>To set defaults
gcloud config set compute/zone ...gcloud config set compute/region ...To create your VM through command-line, run the following command:
gcloud compute instances create gcelab2 \
--machine-type n1-standard-2 \
--zone $ZONECommand details
gcloud computeallows you to manage your Compute Engine resources in a format that's simpler than the Compute Engine API.instances createcreates a new instance.gcelab2is the name of the VM.The
--machine-typeflag specifies the machine type as n1-standard-2.The
--zoneflag specifies where the VM is created.If you omit the
--zoneflag, thegcloudtool can infer your desired zone based on your default properties. Other required instance settings, such asmachine typeandimage, are set to default values if not specified in thecreatecommand.
To SSH through command line
gcloud compute ssh gcelab2 --zone us-central1-cMake sure to add your zone, or omit the --zone flag if you've set the option globally.
To list your instances
gcloud compute instances listLast updated
Was this helpful?