Droplets are the atomic unit of of compute instances on the Digital Ocean cloud service. They are available in a variety of RAM, HD, CPU configurations.
droplet = d0.create_droplet(name='Random',
size_id=66, #512MB
image_id=1341147, #Docker 0.7 Ubuntu 13.04 x64
region_id=1, #New York
ssh_key_ids=[new_key['id']]
)
droplet = d0.get_droplet(923125)
droplets = d0.get_all_droplets()
This method allows you to take a snapshot of the droplet once it has been powered off, which can later be restored or used to create a new droplet from the same image. Please be aware this may cause a reboot.
Parameters: | size – The NAME of the snapshot |
---|
https://api.digitalocean.com/droplets/[droplet_id]/snapshot/?name=[snapshot_name]& client_id=[your_client_id]&api_key=[your_api_key]
This method destroys one of your droplets - this is irreversible.
Parameters: | scrub_data (bool) – An optional bool which will strictly write 0s to your prior |
---|
partition to ensure that all data is completely erased. True by default
https://api.digitalocean.com/droplets/[droplet_id]/destroy/? client_id=[your_client_id]&api_key=[your_api_key]
Method to update Droplet
https://api.digitalocean.com/events/[event_id]/? client_id=[your_client_id]&api_key=[your_api_key]
This method will reset the root password for a droplet. Please be aware that this will reboot the droplet to allow resetting the password.
https://api.digitalocean.com/droplets/[droplet_id]/password_reset/? client_id=[your_client_id]&api_key=[your_api_key]
Convenience method to return the percentage of event completion
This method allows you to power cycle a droplet. This will turn off the droplet and then turn it back on.
https://api.digitalocean.com/droplets/[droplet_id]/power_cycle/? client_id=[your_client_id]&api_key=[your_api_key]
This method allows you to power off a droplet. This will turn off the droplet and then turn it back on.
https://api.digitalocean.com/droplets/[droplet_id]/power_off/? client_id=[your_client_id]&api_key=[your_api_key]
This method allows you to power on a previously powered off droplet.
https://api.digitalocean.com/droplets/[droplet_id]/power_on/? client_id=[your_client_id]&api_key=[your_api_key]
This method allows you to reboot a droplet. This is the preferred method to use if a server is not responding.
https://api.digitalocean.com/droplets/[droplet_id]/reboot/? client_id=[your_client_id]&api_key=[your_api_key]
This method allows you to reinstall a droplet with a default image. This is useful if you want to start again but retain the same IP address for your droplet.
Parameters: |
|
---|
https://api.digitalocean.com/droplets/[droplet_id]/rebuild/?image_id=[image_id]& client_id=[your_client_id]&api_key=[your_api_key]
This method renames the droplet to the specified name.
Parameters: | name (str) – Name of the new droplet |
---|
https://api.digitalocean.com/droplets/[droplet_id]/rename/? client_id=[your_client_id]&api_key=[your_api_key]&name=[name]
This method allows you to resize a specific droplet to a different size. This will affect the number of processors and memory allocated to the droplet.
REQUIRES SNAPSHOT OF DROPLET
Parameters: | size (int) – The new SIZE id of the droplet |
---|
https://api.digitalocean.com/droplets/[droplet_id]/resize/?size_id=[size_id]& client_id=[your_client_id]&api_key=[your_api_key]
This method allows you to restore a droplet with a previous image or snapshot. This will be a mirror copy of the image or snapshot to your droplet. Be sure you have backed up any necessary information prior to restore.
Parameters: | image_id (int) – ID of the image you would like to use to rebuild your droplet with |
---|
https://api.digitalocean.com/droplets/[droplet_id]/restore/?image_id=[image_id]& client_id=[your_client_id]&api_key=[your_api_key]
This method enables/disables automatic backups which run in the background daily to backup your droplet’s data.
Parameters: | scrub_data – A bool which enables/disables backups |
---|
https://api.digitalocean.com/droplets/[droplet_id]/enable_backups/? client_id=[your_client_id]&api_key=[your_api_key]
This method allows you to shutdown a droplet. The droplet will remain in your account.
https://api.digitalocean.com/droplets/[droplet_id]/shutdown/ ?client_id=[your_client_id]&api_key=[your_api_key]
Method to update Droplet (primarily used to update ip information and state changes)
https://api.digitalocean.com/events/[event_id]/? client_id=[your_client_id]&api_key=[your_api_key]