2
2

More than 3 years have passed since last update.

AWS EC2間でSSH接続する

Last updated at Posted at 2020-04-21

はじめに

  • AWS VPCの勉強がてら、管理用サブネット~公開サブネット間のSSH接続の試験をしたメモです。

Internal SSH

  • 公開サーバのインスタンス作成時に、キーペアを作成する。
  • TeraTermを使って、踏台サーバに、xxx.pemをSCPで送信する image.png
アップロードしたファイルのパーミッションを変更する
sudo chmod 600 xxx.pem
踏台サーバにコンフィグファイルを作る
touch ~/.ssh/config
vi .ssh/config
.ssh/config
Host wss
    HostName 172.10.0.xxx #IPアドレス
    User ubuntu
    IdentityFile ~/xxx.pem
    Port 22
ターゲットにssh接続する
ssh wss
yes/noを聞かれるので応答する
yes
接続完了
Welcome to Ubuntu 18.04.4 LTS (GNU/Linux 4.15.0-1057-aws x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Wed Apr 15 09:47:18 UTC 2020

  System load:  0.12              Processes:           92
  Usage of /:   18.8% of 7.69GB   Users logged in:     0
  Memory usage: 18%               IP address for eth0: 172.10.0.xxx
  Swap usage:   0%


0 packages can be updated.
0 updates are security updates.


*** System restart required ***
Last login: Wed Apr 15 09:41:44 2020 from 172.10.200.xxx
ubuntu@ip-172-10-0-xxx:~$

ネットワークACL

ManagementNetworkACL

nwacl1.png

ExternalNetworkACL

image.png

セキュリティグループ

ManagedServer

Inbound

instanceInbound.png

Outbound

image.png


WebServiceServer

Inbound

instance2Inbound.png

Outbound

image.png

おわりに

  • ネットワークACLは、ステートレス
  • セキュリティグループは、ステートフル
  • WebServiceServerのセキュリティグループは、開発専用  - ポート:8000 → 80、ソース:0.0.0.0/0
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2