26
votes

Added an RSA deploy key to my private github repo, but when I add it to my OpsWorks rails app (paste public key into the "Repository SSH Key" field), and try to save, I get the error message "Please provide a valid SSH key".

Key was generated using ssh-keygen defaults (RSA 2048, no passphrase).

Not sure what else could be amiss.

3

3 Answers

45
votes

Ah ... silly me.

AWS OpsWorks is asking for the key that will be deployed to the app server, so it needs the private key (including -----BEGIN RSA PRIVATE KEY----- and -----END RSA PRIVATE KEY----- delimiters).

The github deploy key, obviously, is the public key.

3
votes

AWS Opsworks needs the private key instead of the public. If the field returns:

Please provide a valid SSH key

You probably copy pasted the public key. After you've generated a SSH key (for more information about this see: https://help.github.com/articles/generating-ssh-keys/ )

You want to copy the private key by entering the following command in your terminal.

pbcopy < ~/.ssh/id_rsa

And then paste the private key in the Repository SSH field. Please note that you need to assign the public key to the repository.

http://docs.aws.amazon.com/opsworks/latest/userguide/workingapps-deploykeys.html

1
votes

I solved this problem by following these steps:

  1. ssh-keygen -t rsa -C "[email protected]" -m PEM
  2. When you get to this step Enter passphrase (empty for no passphrase): just press return to skip passphrase setup. Otherwise, AWS won't able to clone your app repo