Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
0
Help us understand the problem. What is going on with this article?
@huong

【GCP】ゾーン間のVMインスタンスを接続

More than 1 year has passed since last update.

VM作成

GCP Consoleで

Name: my-vm-1
Region: us-central1
Zone: us-central1-a
Boot disk: Debian GNU/Linux 9 (stretch)
Access scopes: Allow default access
Firewall: Allow HTTP traffic(受信HTTPトラフィックを許可します)

gcloud command で

リージョン指定
gcloud compute zones list | grep us-central1
ゾーン設定
gcloud config set compute/zone us-central1-b
VM作成
gcloud compute instances create "my-vm-2" \
--machine-type "n1-standard-1" \
--image-project "debian-cloud" \
--image "debian-9-stretch-v20190213" \
--subnet "default"

結果
image.png
my-vm-2
image.png

Connect between VMインスタンス

image.png
ssh クリック
my-vm-1へ接続する為、次のコマンドを実行
ssh my-vm-1
image.png
my-vm-1インスタンスで Nguixウェブサーバーインストール
sudo apt-get install nginx-light -y
image.png
sudo nanoでindex.nginx-debian.htmlファイルを編集
sudo nano /var/www/html/index.nginx-debian.html
image.png
保存して終了
Ctrl+O→Enter→Ctrl+X
my-vm-1提供するウェブサーバーを確認するコマンド
curl http://localhost/
image.png
my-vm-1コマンドプロンプトを終了、次のコマンドを実行
exit
my-vm-2コマンドプロンプトへ戻る
image.png
my-vm-2コマンドプロンプトでmy-vm-1のウェブサーバーに到達できる確認コマンド
curl http://my-vm-1/
image.png
http://my-vm-1/
image.png

0
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
0
Help us understand the problem. What is going on with this article?