I’m starting to work on a project that will use the DO API to spin up large VM instances for short process runs. The idea is I will spin up the VM and provide a script that will run the task at hand. That script will do some intensive compute and upload the results somewhere. The VM will then power itself off, and a monitor process on my end will check every minute; once the VM is powered off it will be destroyed via the API. I have one question though: I’m not clear on how granular the Digital Ocean billing system is.
I’ve experimented with the lowest spec VM, but its per-hour billing is less than $0.01, so it doesn’t matter if I use it for one minute or for one hour, I’m still going to be billed $0.01.
However, if I spin up a very expensive droplet (such as a 256GB memory-optimized droplet) which runs a script doing some intensive processing that takes only around 15 minutes, am I billed for one hour of that VM, or am I billed for 15 minutes of it? The largest memory-optimized VM costs $2.97/hour, so does this mean the minimum billable time period is $2.97 even if I spin up the VM and immediately destroy it?
Similarly, what if the VM runs for one hour and thirty seconds? Am I then billed $5.94, or am I billed $3.02 ($2.97 + ~5c for the extra minute) This scenario could get expensive and ugly if billing is strictly hourly; suppose my process finished at 59:45 after the VM was created, but the script I am running to check for and destroy the VM when it is finished only checks once per minute, and it doesn’t grab the status and destroy the VM until 01:00:05 - I’d then be billed an extra $2.97 for five seconds during which the VM was powered off.
If there is more granularity, what level is it? Per minute? Per second? etc.?
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.