So I want to create a Snapshot from a Droplet and then create a new Droplet from said Snapshot (and delete the old Droplet once I confirmed that it is working as expected).
The whole point in doing so is to change the IP address of the Droplet.
Technically it is not a problem but it involves some horrible looping which I really can’t make a “while True”.
Once I created the snapshot via
/v2/droplets/$DROPLET_ID/actions, the response doesn’t tell me how to identify the snapshot once it has been created but solely the action id.
I could of course request
/v2/actions/$ACTION_ID until the status is not “in-progress” but this wouldn’t help much. So what I do is requesting
/v2/snapshots up to 10 times with a
sleep(30) (Python) in between and hoping to identify the droplet by name.
Drawbacks are of course endless. Has anyone done something similar with a better approach?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Click below to sign up and get $200 of credit to try our products over 60 days!