Upload Folder from Local Machine to EC2 Instance

Uncategorized

This was a problem that I was trying to figure out on my Windows Machine.  Here’s the steps it took for me to be able to do it.

1.  Download an SSH client.  I downloaded OpenSSH.  It’s a free download that you can get from here.

2.  Now check and see if you can SSH into your EC2 instance.   To do this, open up powershell and navigate to the folder where you store your .pem file.  This isn’t necessary, but it’s easier for the tutorial.  Now try to SSH into the instance like so.

ssh -i PemFile.pem ec2-user@xx.xxx.xx.xx

If it was successful you’ll see a screen that looks like this.

The authenticity of host ‘ec2-xxx-xx-xxx-1.compute-1.amazonaws.com (xx.xxx.xxx.xx)’ can’t be established.
RSA key fingerprint is 1f:51:ae:28:bf:89:e9:d8:1f:25:5d:37:2d:7d:b8:ca:9f:f5:f1:6f.
Are you sure you want to continue connecting (yes/no)?

Type in yes.  And you’re logged in.

3.  Now type “exit” so you can leave your remote instance.

4.  Now here’s the command line prompt to actually copy the folder to your remote instance.

scp -i PemFile.pem -r folder/to/copy/ ec2-user@xx.xxx.xx.xx:/destination/folder/to/copy/into/to

You’ll now see the same screen you saw before.

The authenticity of host ‘ec2-xxx-xx-xxx-1.compute-1.amazonaws.com (xx.xxx.xxx.xx)’ can’t be established.
RSA key fingerprint is 1f:51:ae:28:bf:89:e9:d8:1f:25:5d:37:2d:7d:b8:ca:9f:f5:f1:6f.
Are you sure you want to continue connecting (yes/no)?

Type yes, and you’ll see the contents of the folder copying. After it’s done, SSH into your instance and check to see if your folder is where you wanted it to be.

And that’s it!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s