- 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.
推薦閱讀
- 亮劍.NET:.NET深入體驗(yàn)與實(shí)戰(zhàn)精要
- 大數(shù)據(jù)專(zhuān)業(yè)英語(yǔ)
- Java開(kāi)發(fā)技術(shù)全程指南
- 來(lái)吧!帶你玩轉(zhuǎn)Excel VBA
- Windows XP中文版應(yīng)用基礎(chǔ)
- SharePoint 2010開(kāi)發(fā)最佳實(shí)踐
- 現(xiàn)代傳感技術(shù)
- 統(tǒng)計(jì)學(xué)習(xí)理論與方法:R語(yǔ)言版
- INSTANT Drools Starter
- Prometheus監(jiān)控實(shí)戰(zhàn)
- 悟透AutoCAD 2009完全自學(xué)手冊(cè)
- The Python Workshop
- 貫通Java Web開(kāi)發(fā)三劍客
- 突破,Objective-C開(kāi)發(fā)速學(xué)手冊(cè)
- Creating ELearning Games with Unity