LoginSignup
5
3

More than 1 year has passed since last update.

AWS EC2にVSCodeでRemote-SSH接続(Windows)

Posted at

AWS EC2インスタンスにTera Termではなく、VScodeで接続
とても簡単で、これするだけでGUIで感覚的な操作ができます。

EC2 OSはAmazon Linux 2の場合ユーザ名は「ec2-user」です。
(そのほかのOSのEC2の場合はAWSのリファレンスを確認)

手順

  • VScodeで拡張機能「Remote-SSH」インストール
  • VScodeウィンドウの左に「リモートエクスプローラー」のアイコンが現れるのでクリック
  • プルダウンで「SSH Targets」を選択
  • 歯車アイコンをクリック
  • 「C:\Users[ユーザ名].ssh\config」 を選択
  • 以下を入力して保存
Host (任意)
HostName [EC2パブリックアドレス]
Port 22
IdentityFile [pemキーのパス]
User ec2-user
  • VSCodeウィンドウ左下の緑色の"><"ボタンを押す
  • 表示されたメニューから「Connecto to Host...」を選択
  • configに入力したHost名を選択「ec2」
  • Select the platform of the remote host "ホスト名"と聞かれたら「Linux」を選択
  • 初回接続で「Continue」と「Cancel」が聞かれたら、「Continue」を選択
  • 「フォルダ開く」を選択してEC2上の好きなフォルダを選択
  • これだけでGUIの操作ができます
5
3
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
5
3