- 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.
推薦閱讀
- Splunk 7 Essentials(Third Edition)
- 中文版Photoshop CS5數(shù)碼照片處理完全自學(xué)一本通
- 計(jì)算機(jī)應(yīng)用基礎(chǔ)·基礎(chǔ)模塊
- 輕松學(xué)Java
- 返璞歸真:UNIX技術(shù)內(nèi)幕
- PostgreSQL Administration Essentials
- 統(tǒng)計(jì)策略搜索強(qiáng)化學(xué)習(xí)方法及應(yīng)用
- 基于ARM 32位高速嵌入式微控制器
- 計(jì)算機(jī)與信息技術(shù)基礎(chǔ)上機(jī)指導(dǎo)
- TensorFlow Reinforcement Learning Quick Start Guide
- 電子設(shè)備及系統(tǒng)人機(jī)工程設(shè)計(jì)(第2版)
- Learn Microsoft Azure
- Cloudera Hadoop大數(shù)據(jù)平臺(tái)實(shí)戰(zhàn)指南
- 工廠電氣控制設(shè)備
- Java Deep Learning Projects