LoginSignup
2
4

More than 5 years have passed since last update.

Windows10 VisualStudioCodeでRemote Devlopment

Last updated at Posted at 2019-06-07

概要

VSCode(2019/06/05 release版)にRemoteDevelopmentが追加させたので
Windows10でEC2に接続してコードを触ってみた

VSCodeにRemoteDevelopをインストール

  1. 拡張機能からRemoteDevelopmentを検索
  2. インストール
  3. Remote SSH,Remote WSL,Remote Containerが一緒にインストールされる

Windows10にOpenSSHをインストール

  • PowerShellを管理者権限で起動
Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'

# This should return the following output:

Name  : OpenSSH.Client~~~~0.0.1.0
State : NotPresent
Name  : OpenSSH.Server~~~~0.0.1.0
State : NotPresent
  • ssh clientをインストール
# Install the OpenSSH Client
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0

ssh configの設定

  • 下記のファイルを設定
c:\user\{user}\.ssh\config
Host {host name}
     HostName {ip}
     User {user}
     IdentityFile {key file path}

※ 例

Host centos-server
     HostName 10.42.XX.XX
     User centuser
     IdentityFile ~\.ssh\xxxx.pem
  • 踏み台を設定して接続する場合
Host {host-name}
     HostName {ip}
     User {user}
     IdentityFile ~\.ssh\xxxx.pem
     ProxyCommand C:\Windows\System32\OpenSSH\ssh.exe -W %h:%p fumidai_server

VScodeからサーバーに接続

  1. RemoteDevelopment アイコンを左のメニューから選択
  2. 右上の設定からssh configを選
  3. ssh configに書かれたhostが一覧で表示される
  4. 一覧からhostを選択するとサーバー側に自動でVSCodeServerがインストールされ接続される
  5. サーバー内のコードパスを選択し表示
  6. コードを書くことができるようになる!
2
4
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
4