1
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?

[EC2]ssh: connect to host xx.xxx.xxx.xxx port 22: Operation timed outの解決方法

Posted at

はじめに

EC2でインスタンスを起動時に発生したエラーについての記事になります。

この記事は個人的なアウトプットを目的として作成したものです。そのため、誤った情報や不足している内容が含まれている可能性があります。もし間違いや気になる点がございましたら、ぜひご指摘いただけますと幸いです

現象

EC2インスタンスのSSH接続時に下記のようなエラーが発生しました。SSH接続に必要な22番ポートがタイムアウトになってしまいました。

ssh: connect to host xx.xxx.xxx.xxx port 22: Operation timed out

解決方法

インバウンドルールにポート22番を許可するように変更します。

スクリーンショット 2025-04-20 13.11.30.png

セキュリティグループでポートの設定をしているの問題ないと思っていました。セキュリティグループはVPC内の通信制御をするものですが、SSH接続は外部(今回はローカルPC)からのアクセスになるため、インバウンドルールに設定が必要になります。

終わりに

セキュリティグループについて認識が誤っていたので良い機会になりました。引き続きAWSの学習を進めていきます。

参考

『AWSでEC2に接続しようとしたら"ssh: connect to host xx.xxx.xx.xxx port 22: Operation timed out"と出た』Qiita

1
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
1
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?