Skip to content

Instantly share code, notes, and snippets.

@mwin007
Created November 29, 2015 08:00
Show Gist options
  • Save mwin007/6de42bc02975c128aaae to your computer and use it in GitHub Desktop.
Save mwin007/6de42bc02975c128aaae to your computer and use it in GitHub Desktop.
Rsync to AWS EC2 Using .PEM key
The standard AWS EC2 instances support using a .PEM key to log in, instead of a more common SSH username/password combination. If you want to use Rsync to transfer data from your local machine to an AWS EC2 instance you will need to change the Rsync command to be something like this:
1
rsync -rave "ssh -i PEMKEYFILE.pem" /path/to/local/files/* ec2-user@EC2_INSTANCE_HOSTNAME:/path/to/remote/files
For simplicities sake I ensured that I was in the directory where the .pem key was saved, but you can adjust the command to give the path to your key file.
Beyond this it's just like regular Rsync, so just follow the on-screen commands and you get secured file transfer between your local machine and your remote AWS EC2 instance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment