0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【AWS】EC2にSSH接続できない(固まる)ときの原因と対処法

0
Posted at

はじめに

EC2でサーバーを立ててSSH接続してサービスを公開していました。後日、もう一度SSH接続しようとしたら失敗しました。

問題

以下のコマンドを打って接続を試みても、反応が何もない。固まる。

ssh -i キーのパス ec2-user@パブリックIP

解決方法

1. IPアドレスを確認する

以下のコマンドを実行して、自分のIPアドレスを調べます。

curl ifconfig.me

2. セキュリティグループのソースを変更する

コンソールやTerraformからセキュリティグループインバウンドルールにあるCIDR自分のIPアドレス/32に変更します。

おわりに

自分のIPアドレスが変わったことでセキュリティグループの許可ルールとIPがずれ、SSH接続できなくなっていました。あまりIPアドレスを意識したことがなかったのでいい経験になりました。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?