4

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 a@b.com -i "key.pem"
starball
  • 20,030
  • 7
  • 43
  • 238
Jane Maths
  • 43
  • 2

1 Answers1

4

There are at least 3 ways to do it from GNU Parallel:

seq 10 | parallel --sshlogin 'ssh -i "key.pem" a@b.com' echo 

seq 10 | PARALLLEL_SSH='ssh -i "key.pem"' parallel --sshlogin a@b.com echo 

seq 10 | parallel --ssh 'ssh -i "key.pem"' --sshlogin a@b.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).

Ole Tange
  • 31,768
  • 5
  • 86
  • 104