主題教學二

客戶問題

我們要如何設定僅能夠透過辦公室的電腦連線伺服器,以利滿足資訊安全的需求呢?

操作步驟

執行初始設定工作

gcloud init --console-only

建立網路

gcloud compute networks create demo-network --subnet-mode auto
gcloud compute instances create vm2 --zone asia-east1-a --image-family centos-8 --image-project centos-cloud --boot-disk-type=pd-standard --boot-disk-size=100GB --subnet demo-network
curl https://ipinfo.io/ip
gcloud compute firewall-rules create demo-allow-ssh --network demo-network --source-ranges "35.221.243.87" --allow tcp:22
gcloud compute ssh vm2 --zone asia-east1-a --command "echo 'Hello World'"
gcloud compute firewall-rules update demo-allow-ssh --target-tags ssh
gcloud compute ssh vm2 --zone asia-east1-a --command "echo 'Hello World'"
gcloud compute instances add-tags vm2 --tags ssh
gcloud compute ssh vm2 --zone asia-east1-a --command "echo 'Hello World'"