How Can I Download a File from EC2

user1226621 picture user1226621 · Feb 25, 2012 · Viewed 146.2k times · Source

What scp arguments should I use to download a file from an Amazon EC2 instance to local storage?

Answer

icyrock.com picture icyrock.com · Feb 25, 2012

Use scp:

scp -i ec2key.pem username@ec2ip:/path/to/file .

where:

  • ec2key.pem is your PEM key
  • username is the username you log in with
  • ec2ip is the IP or DNS alias of the instance
  • /path/to/file is the location where the file is stored

This will copy the file into the current folder on the local machine.

You can read more here on how to access your instance with ssh if you haven't done already:

When you are able to ssh as in the above doc, you will be able to use scp to copy the file.

Another option is to bring up some Web server on your instance, configure HTTPS if your file is sensitive and then download using your browser, here are some tutorials: