Hey everyone,
I’m new to DigitalOcean and exploring ways to optimise costs, especially during off-hours. I’d love to learn how you handle automating tasks like shutting down droplets that aren’t in use.
How are you currently automating droplet or cluster shutdowns for cost optimisation? For example, managing Dev/Test workloads, weekly batch processing, etc.
I’m fairly technical (though new to DO) and can think of using scripts with the DO APIs to handle this, but managing multiple droplets could get pretty unwieldy.
Lastly, are there any add-ons or tools in the DO Marketplace that you’d recommend for this kind of use case?
Looking forward to your insights—thanks in advance!
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.
Hey Sudarshan! 👋
Welcome to DigitalOcean! Automating droplet management is a smart way to optimize costs, especially for non-production workloads like Dev/Test environments.
There are a few ways to do this:
1. Using the DigitalOcean API and
doctl
:The DigitalOcean API provides endpoints for managing Droplets, such as creating, powering off, or deleting them. You can use this with a cron job or scheduler to automate the process. For example:
Shutdown a Droplet:
Start a Droplet:
Delete a Droplet:
It’s important to note that even if a Droplet is powered off, you will still be charged for the allocated resources. To stop incurring charges, you need to delete the Droplet. You can always use a snapshot before deletion to preserve the state of your Droplet.
2. Consider Kubernetes for Auto-Scaling:
If your workload can be containerized, Kubernetes can be a great alternative for managing resources dynamically. DigitalOcean Kubernetes supports auto-scaling, allowing you to scale up and down based on resource demands automatically. Check out this guide for more details: 👉 How to Enable Auto-Scaling in DigitalOcean Kubernetes
3. Explore Serverless Functions:
For even more cost optimization, you could consider moving certain workloads to DigitalOcean Functions:
👉 https://docs.digitalocean.com/products/functions/
Hope that this helps and let me know if you have any questions!
- Bobby
Heya, @sudarshan89
On top of what’s already been mentioned. You can leverage DigitalOcean’s monitoring service to track resource utilization in real-time. Pair this with automation to dynamically scale resources:
In order to avoid being charged for idle droplets, automate snapshot creation and droplet deletion:
Also If you have predictable workload cycles, use job schedulers like
cron
or orchestration tools like Ansible to automate provisioning:Hope that this helps!