- Google Cloud Platform Cookbook
- Legorie Rajan PS
- 169字
- 2021-08-27 19:13:23
Creating and configuring a GCE instance
After creating the start up script, follow these steps:
- With the start up script ready, we can create an instance using the gcloud command:
$ gcloud compute instances create mysite-instance \ --image-family=debian-8 \ --image-project=debian-cloud \ --machine-type=g1-small \ --scopes userinfo-email,cloud-platform \ --metadata-from-file startup-script=./startup-script.sh \ --zone us-east1-c \ --tags mysite-server
- You can check the progress of the instance creation using the following command:
$ gcloud compute instances get-serial-port-output \
mysite-instance --zone us-east1-c
- Create a firewall rule to allow access to port 3000 to the instance:
$ gcloud compute firewall-rules create default-allow-http-3000 \ --allow tcp:3000 \ --source-ranges 0.0.0.0/0 \ --target-tags mysite-server \ --description "Allow port 3000 access to mysite-server"
The following screenshot shows the details of the firewall rule:

The tags on the firewall rule and the create instance commands should match.
- Get the public IP of the instance from the Google Cloud Console or by using the following command:
$ gcloud compute instances list
- Navigate to http://<public IP of the instance>:3000 to see the application running.
推薦閱讀
- 中文版Photoshop CS5數碼照片處理完全自學一本通
- 面向STEM的mBlock智能機器人創新課程
- 空間機器人遙操作系統及控制
- 影視后期制作(Avid Media Composer 5.0)
- Mobile DevOps
- Matplotlib 3.0 Cookbook
- 群體智能與數據挖掘
- 小型電動機實用設計手冊
- 完全掌握AutoCAD 2008中文版:綜合篇
- Enterprise PowerShell Scripting Bootcamp
- 我也能做CTO之程序員職業規劃
- Storm應用實踐:實時事務處理之策略
- 空間站多臂機器人運動控制研究
- 案例解說Delphi典型控制應用
- Cloudera Hadoop大數據平臺實戰指南