Need a bit of help with this.
I want to manually run a script every now and then to move files between my production and dev instances.
at the moment I have this as a shell script:
rsync --progress -avz -e "ssh -vvv -i $HOME/.ssh/my-ubuntu-ec2.pem" ubuntu@:111.111.111.111/var/www/test /var/www/test
My issue is that I cannot locate or contact the .pem file. I have scoured the usual places and done a file search across the whole system, but nothing.
The keypair in question was created through the console, and I manually added the keys to the authorized_keys in the usual way. I would have thought the console would have deployed the keys to the EC2 instance, but that doesn't seem to be the case. At least, I can't find them.
I am sure someone will be able to spot where I am going wrong!
Thanks in advance,
Jason
When creating a Keypair in the Amazon EC2 management console, a keypair (.pem
file) is downloaded to your computer. This is the private key.
Creating a keypair in the console does not put the key on any existing Amazon EC2 instances. However, when launching a new instance, you can select a keypair and it will be added to the /home/ec2-user/.ssh/authorized_keys
file.
If you have the private key, you can generate a public key from the .pem file with:
ssh-keygen -y -f key.pem > key.pub
The public key should be placed in the destination computer's ~/.ssh/authorized_keys
file for destination user (which is ubuntu
in your command sample).
The private key should be used on the source computer (as per my-ubuntu-ec2.pem
in your code sample).
If you have lost the private key, you will need to generate a new one and replace the keys on the instances.