- Google Cloud Platform for Architects
- Vitthal Srinivasan Janani Ravi Judy Raj
- 425字
- 2021-06-25 20:48:28
Creating a VM instance using the command line
An easy way to get the right command line is to piggyback on the web console—it has a neat little way to get the command line corresponding to a particular UI operation:
- As before, start with the hamburger (three horizontal lines).
- Navigate to Compute, and then to VM instances.
- Click on Create a VM instance in the VM instances page and you'll get the UI to set up the configuration for this virtual machine.
- Specify the configuration parameters using this console, as we saw in the previous section. At the very bottom of this form, you can find the Equivalent REST or command line option.
- Click on both of these to get the Equivalent REST and gcloud commands respectively to set up the VM with the exact settings specified. The gcloud command is what you can use within scripts in order to create multiple VM instances with the same configuration.
- Click on the icon with ≥ sign on the top-right side beside search bar. Open up your Cloud Shell from the console, which is completely free to use, and paste the gcloud command and hit Enter to create a new VM instance. Refresh the browser to see the new VM listed in the VM instances page.

Running help on this gcloud compute instance create command should show you all the options that you have available and you can use these to create custom instances from the Cloud Shell. But if you want to customize your instance with a lot of parameters, it's better to specify them on the web console, generate the corresponding command-line command, and use that:
gcloud compute instances create --help
You can further set up some default values in your configuration file so that any new instances that you create will use this default value. For example, if you set the default zone to be us-central1-a, all new instances will be created in this zone:
gcloud config set compute/zone us-central1-a
Note that if you wish to SSH into an instance that is not in the default zone from the Cloud Shell, you'll need to explicitly specify the zone using the zone parameter in the SSH command.
Now we know that if we wanted to automate the creation of virtual machines with specialized configurations, we can simply write a script with the required gcloud command, which is easily obtained by setting up the configuration on our web console and clicking on the Equivalent REST or command line link at the very bottom.
- 我們都是數(shù)據(jù)控:用大數(shù)據(jù)改變商業(yè)、生活和思維方式
- ETL數(shù)據(jù)整合與處理(Kettle)
- Spark快速大數(shù)據(jù)分析(第2版)
- 劍破冰山:Oracle開發(fā)藝術
- 企業(yè)大數(shù)據(jù)系統(tǒng)構(gòu)建實戰(zhàn):技術、架構(gòu)、實施與應用
- 深入淺出數(shù)字孿生
- 大數(shù)據(jù):從概念到運營
- Hands-On Mathematics for Deep Learning
- 基于OPAC日志的高校圖書館用戶信息需求與檢索行為研究
- SQL應用及誤區(qū)分析
- Chef Essentials
- MySQL技術內(nèi)幕:SQL編程
- Access 2010數(shù)據(jù)庫程序設計實踐教程
- 商業(yè)智能工具應用與數(shù)據(jù)可視化
- Filecoin原理與實現(xiàn)