koalalorenzo / python-digitalocean

🐍🐳 Python module to manage Digital Ocean droplets
GNU Lesser General Public License v3.0
1.26k stars 301 forks source link

how to create droplet from snapshots #311

Closed GOPIPACHA closed 4 years ago

GOPIPACHA commented 4 years ago

Hi all, Let me come to point straight I am have some snapshot in digital ocen account, iwanted to create a droplet from those snapshots,can anyone help me out how can i do this using python?

Thanks in advance !!

andrewsomething commented 4 years ago

When you create a new Droplet, you can specify the image you want to use. That can be a DigitalOcean base image (e.g. ubuntu-20-04-x64) or the ID of your snapshot.

Here's a basic example:

import digitalocean

droplet = digitalocean.Droplet(token="digitalocean-api-token",
                               name='example.com',
                               region='nyc3',
                               image='123456789', # ID of you Droplet snapshot
                               size_slug='s-1vcpu-1gb')
droplet.create()
GOPIPACHA commented 4 years ago

Hi thanks for reply it works like a charm