Report this

What is the reason for this report?

Using CLI When Droplet Powered Off

Posted on April 21, 2014

I’m trying to run part of the shell script found at…

https://www.digitalocean.com/community/articles/how-to-scale-your-infrastructure-with-digitalocean

…to be able to take a snapshot. However, the snapshot function within the script returns an error message.

{“status”:“ERROR”,“error_message”:“Droplet is currently on. Please power it off to run this event.”,“message”:“Droplet is currently on. Please power it off to run this event.”}

So I power off. But since the system is now down, I can’t run the shell program via the terminal. In searching for solutions with other articles and finding this one…

https://www.digitalocean.com/community/articles/how-to-use-digitalocean-snapshots-to-automatically-backup-your-droplets

…,it too recommends powering off the droplet first, then to use curl and commands through the CLI .

However, the terminal window, usually available through Digital Ocean, is not viewable when the droplet is off. Nor can I connect through my PC’s terminal with ssh. How does one use CLI/terminal with a droplet powered off?

I’m probably overlooking something simple but can’t realize it. Many thanks to an answer.



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.

In both cases, the commands are meant to be run on the command line of a different machine than the droplet you want to snapshot. If you are using Mac or Linux, you can just use the terminal that came with the OS. If you are on windows you could run it from another droplet, or look into something like Cygwin: <br> <br>http://www.cygwin.com/ <br> <br>

Thanks again for the reply. <br> <br>Just to clarify and to state my current understanding of this problem… <br> <br>I need to spin a 2nd droplet and operate off of this active server, in order to be able to run a script to make a snapshot for the 1st droplet, which has to be powered off, in order to make the snapshot. <br> <br>That possessing just one droplet in power off mode won’t work, since 1) D.O.'s terminal for a shutdown droplet is not able to be accessed, and therefore can’t run the script, and 2) my PC’s Linux terminal won’t connect to a shutdown droplet, again, not allowing me to run the script. <br> <br>Overall, two droplets are needed. Is this right or am I still overlooking something? Thanks.

From your PC’s Linux terminal, you do not need to connect to the powered off droplet to take the snapshot. You need to make a call to DigitalOcean’s API. For example, on your local PC, run this from the command line (using your real client ID and API key): <br> <br><pre> <br>curl -X GET “https://api.digitalocean.com/droplets/?client_id=$DO_CLIENT_ID&api_key=$DO_API_KEY” <br></pre> <br> <br>It should return a JSON string that lists your droplets and information about them. You can do the same to take a snapshot. <br> <br><pre> <br>curl -s “https://api.digitalocean.com/droplets/$DROPLET_ID/snapshot/?client_id=$DO_CLIENT_ID&api_key=$DO_API_KEY” <br></pre> <br> <br>So if you want to use the script from the tutorial, just download it and use it locally.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.