How can one run parallel jobs on Amazon AWS EC2 with gnu parallel. I need to include private key to log in namely something like this does not work:
sh script.sh | parallel --sshlogin firstname.lastname@example.org -i "key.pem"
There are at least 3 ways to do it from GNU Parallel:
seq 10 | parallel --sshlogin 'ssh -i "key.pem" email@example.com' echo seq 10 | PARALLLEL_SSH='ssh -i "key.pem"' parallel --sshlogin firstname.lastname@example.org echo seq 10 | parallel --ssh 'ssh -i "key.pem"' --sshlogin email@example.com echo
On top of that you can probably use .ssh/config (man ssh_config), so you use the same key for access to *.amazon.com.
Also you should learn
ssh-agent. With that you can add multiple keys. Though this is only useful in sessions with a controlling terminal (e.g. not useful for cron jobs).