14
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SCPを使ってローカルからAWS EC2サーバーへファイルをアップロードするメモ

Last updated at Posted at 2019-02-19

####一つのファイルをアプロード:

例:

ターミナル
scp -i /Users/.ssh/secretkey.pem /Users/Documents/a.txt ec2-user@ec1-11-111-111-1111.jp-south-1.compute.amazonaws.com

こうすると、サーバーのホームディレクトリにファイルをコピーすることができます
####コピーする場所を指定する:

[@サーバーのパス]

例えば、サーバーの/var/www/htmlにファイルをコピーしたい場合:

ターミナル
scp -i /Users/.ssh/secretkey.pem /Users/Documents/a.txt ec2-user@ec1-11-111-111-1111.jp-south-1.compute.amazonaws.com:/var/www/html

####フォルダごとにコピーしたい場合

例:

ターミナル
scp -r -i /Users/.ssh/secretkey.pem /Users/Documents/ ec2-user@ec1-11-111-111-1111.jp-south-1.compute.amazonaws.com
14
10
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
14
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?