Question
How should I send ssh_keys when creating a droplet API?
I was trying to create a droplet trought API, I created some droplets succesfully without ssh_keys fields, but when I try to use this field I got this error: “are invalid key identifiers for Droplet creation”.
I created the key using digital ocean tutorial, after that I got the fingerprint using this command :
ssh-keygen -lf id_rsa.pub
Then I added this fingerprint value as the first argument of a array of ssh_keys field. I was using nodejs in those tests.
I also try to use curl to test this web service, without ssh_keys everything works, but when I add that field I get the same error.
This is my curl command (token and fingerprint modified for this example).
curl -X POST -H 'Content-Type: application/json' -H 'Authorization: Bearer 701d61eabc12d90cf0efd7a57157f2b998a59455873e5db6d2c062d6234d6b37' -d '{"name":"example.com","region":"nyc3","size":"512mb","image":"ubuntu-14-04-x64","ssh_keys": [ "b4:2a:c9:ec:41:ua:a0:yt:95:5e:6b:2e:aa:a0:ef:aa" ] }' "https://api.digitalocean.com/v2/droplets"
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×