LoginSignup
0
0

More than 1 year has passed since last update.

Visual Studio Code で Remote SSH

Posted at

EC2インスタンスの構築

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

Remote SSHの前準備

Terminal
mv Downloads/remote_ssh.pem .ssh/

image.png

Terminal
[~]$ cd .ssh
[.ssh]$ cat config
# Test
Host Test-EC2
  HostName 54.95.77.94
  IdentityFile ~/.ssh/rails_react_todo_app.pem
  User ec2-user

Host Remote-SSH
  HostName 54.249.53.47
  IdentityFile ~/.ssh/remote_ssh.pem
  User ec2-user

.ssh/configに図の内容を追加してください。

image.png

HostNameはパブリックIPです。
image.png

[.ssh]$ ssh -i ~/.ssh/remote_ssh.pem ec2-user@54.249.53.47
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/Users/XXXXXXXXXXXXX/.ssh/remote_ssh.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "/Users/XXXXXXXXXXXXX/.ssh/remote_ssh.pem": bad permissions
ec2-user@54.249.53.47: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

上記のメッセージが出力されるはず。権限の変更を行う。

$ sudo chmod 600 ~/.ssh/remote_ssh.pem

VS code Remote SSHのインストール

image.png

image.png

image.png

Open Folderして画像のようになっていたら繋がっているはず

image.png

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