Question

Set password instead ssh when python create droplet

Posted December 29, 2021 105 views
API

Hello
I’m trying to create a droplet through api, and i want to set a password instead ssh_keys
how can i do this?
Thanks!

Example:
data = {
‘name’: 'HelloFromPython’,
'region’: 'nyc3’,
'size’: ’s-1vcpu-1gb’,
'image’: 'ubuntu-20-04-x64’,
'backups’: 'False’,
'ipv6’: 'True’,
'password’: 'MYPASSOWRD’,
'userdata’: 'False’,
'monitoring’: 'False’,
'with
droplet_agent’: 'False’,
}

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.

×
Submit an Answer
1 answer

Hey there!

Currently it isn’t possible to inject a password through the API when creating a droplet. You can not specify any SSH keys and a droplet will be created and the password for the droplet will be emailed to you.

API Reference

You may want to look into using user data as you could configure a script to create a user with a password using it.

Hope it helps!
Nate