DigitalOcean Cost Optimization Guide 2026 — Real Cost-Cutting Tips
บิลเซอร์ไพรส์บน Cloud มักเกิดจากสาเหตุเดียวกันซ้ำๆ คือไม่มีการแจ้งเตือนล่วงหน้า
DigitalOcean costs often balloon not because pricing is high, but because purchased resources exceed actual needs and then get forgotten—oversized Droplets, attached Volumes nobody uses, old Snapshots that never get deleted. This guide covers practical ways to audit and cut your DigitalOcean bill, with real doctl commands you can run today. Prices accurate as of July 2026.
Contents
Right-size Your Droplets
The largest cost line item on most DigitalOcean accounts comes from Droplets whose size doesn't match the actual load. You can check each one manually in the Control Panel, but with dozens of Droplets, doctl is much faster. Start by listing everything with specs: doctl compute droplet list --format Name,Memory,VCPUs,Disk,Status, then cross-reference each Droplet name against the CPU and RAM graphs in Monitoring (a free built-in feature). If a Droplet averages CPU below 20% consistently over several weeks, that's a signal it's oversized.
DigitalOcean tiers Droplet Basic (Shared CPU) in fine increments—from 512 MiB RAM/1 vCPU/10GB SSD at $4/month up to 2 GiB RAM/1 vCPU/50GB at $12/month, or 2 GiB RAM/2 vCPU/60GB at $18/month, and 4 GiB/2 vCPU/80GB at $24/month. The granular pricing ladder means you can step down without jumping over unnecessary specs. What to watch for: General Purpose Droplets (Dedicated CPU) start much higher—$63/month for 8GB RAM/2 vCPU/25GB SSD, climbing to $1,260/month at the top. Picking that tier without truly needing dedicated, non-shared CPU—like for heavy batch processing—wastes money compared to Basic for typical websites.
One often-missed detail: per-second billing since January 1, 2026, with a minimum of 60 seconds or $0.01, whichever is higher. This means test Droplets spun up for short CI jobs or script validation, then destroyed immediately, don't cost a full hour's rent like some providers charge. Resize works via doctl compute droplet-action resize droplet-id --size s-2vcpu-4gb --resize-disk=false, where setting resize-disk=false keeps your existing disk if you're only dropping RAM/CPU. Note: disk shrinks are irreversible once resized down.
- Pull all Droplets with doctl compute droplet list, cross-check CPU/RAM graphs in Monitoring before resize decisions.
- Basic Droplets start at $4/month (512 MiB) up to $96/month (16 GiB/8 vCPU), adjustable in fine steps.
- Don't pick General Purpose (Dedicated CPU) starting at $63/month without a real need—far pricier than equivalent Basic for typical workloads.
- Leverage per-second billing (60-second minimum or $0.01) for short-lived test Droplets; no full-hour penalty.
Delete Unused Snapshots and Volumes
Based on real-world use, snapshots and Volumes are silent cost bleeders that pile up unnoticed because they don't show as obvious line items on the Droplet List—yet they're billed separately every month. Block Storage (Volumes) costs $0.10/GiB/month; a 100 GiB Volume runs $10/month, 500 GiB runs $50. Snapshots—whether Droplet or Volume—cost $0.06/GiB/month.
The most common culprit is a Volume detached from a Droplet during data migration or machine decommission but never deleted. It keeps charging $0.10/GiB/month unused. Audit with doctl compute volume list --format ID,Name,SizeGigaBytes,DropletIDs and look for rows where DropletIDs is blank—those are orphaned. Similarly, check Snapshots with doctl compute snapshot list --resource-type droplet --format ID,Name,ResourceId,SizeGigaBytes,Created and doctl compute snapshot list --resource-type volume to find old backups you no longer need.
A workable policy is keep only the 3 most recent Snapshots per Droplet, then purge older ones with doctl compute snapshot delete snapshot-id. For teams managing many Droplets, a small script run weekly to list and compare creation dates beats manual review. And remove unused Volumes with doctl compute volume delete volume-id after confirming the data isn't critical. Small-line-item costs like these compound to real money per month across dozens of resources.
- Volumes cost $0.10/GiB/month; Snapshots (both Droplet and Volume) cost $0.06/GiB/month—silent monthly drain.
- Find unattached Volumes with doctl compute volume list and look for blank DropletIDs.
- Audit old Snapshots with doctl compute snapshot list --resource-type droplet/volume; set a retention policy like keep last 3 only.
- Delete with doctl compute snapshot delete and doctl compute volume delete after confirming data is non-critical.
- Automate weekly scans with a small script if managing many Droplets instead of manual checks.
Set Billing Alerts to Prevent Bill Surprises
Cloud bill surprises usually stem from the same root cause repeated: no early warning when spending drifts above budget. DigitalOcean's Billing Alert feature in Control Panel (Billing menu) lets you set a threshold—for example, alert at 80% of your monthly budget—so you have time to investigate and adjust before the billing cycle closes. This is web-only setup; doctl doesn't have a direct command for Billing Alerts yet.
What you *can* pair with it is Monitoring's Alert Policy, which is free and covers CPU, RAM, Disk, and Bandwidth per Droplet. One reason bills spike unexpectedly is Bandwidth overage from a Droplet transferring beyond its quota—e.g., a $12/month plan gets 2,000 GiB, $24/month gets 4,000 GiB. An Alert Policy can warn you when bandwidth is near the ceiling with something like doctl monitoring alert-policy create --type v1/insights/droplet/public_outbound_bandwidth --value 80 --compare GreaterThan --window 5m --entities droplet-id --emails [email protected], catching unusual spikes—bots, attacks—before they become large overage charges.
Best practice: stack both. Billing Alert at the account level shows the big picture, and Monitoring Alerts on risky Droplets (new launches, public APIs) flag the root cause. Two layers means you see both the forest and the trees.
- Set Billing Alert in Control Panel, Billing menu, to warn at a threshold like 80% of budget (no direct doctl command yet).
- Bandwidth overage is a common bill spike culprit; check your transfer quota per plan—$12/month = 2,000 GiB, $24/month = 4,000 GiB.
- Use doctl monitoring alert-policy create to alert on bandwidth/CPU per Droplet—free, no added cost.
- Alert at 80% of budget, not 100%, to leave time to respond before the cycle closes.
- Combine account-level Billing Alerts with per-Droplet Monitoring Alerts for full visibility.
Use Reserved IPs Only When Necessary
Reserved IPs are static addresses you can move between Droplets without updating DNS—useful for failover—but the pricing model needs clear understanding. If attached to an active Droplet, a Reserved IP costs nothing extra. If reserved but not attached to any Droplet (unattached), it costs $5/month or $0.01/hour. Reserved IPv6, by contrast, is always free regardless of attachment.
Money leaks when you reserve an IP in advance for a future failover plan, then leave it empty for weeks before using it, or reserve it during testing and forget to attach it to the test Droplet. The Reserved IP becomes a $5/month charge with zero utility. Check with doctl compute reserved-ip list --format IP,DropletID,RegionSlug and look for blank DropletID rows—those are costing $5/month unused. If you don't plan to use them soon, release them with doctl compute reserved-ip delete ip-address.
For true High Availability architectures that need instant switchover between primary and standby Droplets without DNS propagation lag (which can take minutes to hours), Reserved IPs are worth the cost. But for a single Droplet with no failover plan, or if you already have a Load Balancer with a built-in static IP, regular Public IPs are plenty and save the $5/month.
- Reserved IP attached to active Droplet = free; unattached (orphaned) = $5/month ($0.01/hour).
- Reserved IPv6 is always free, attached or not.
- Scan for unused IPs with doctl compute reserved-ip list and check for blank DropletID.
- Release idle IPs with doctl compute reserved-ip delete to stop monthly charges.
- Reserve IPs only for real failover scenarios—single Droplets or Load Balancer setups don't need them.
Compare Managed Database vs Self-hosting Costs
Comparing Managed Database to self-hosted on a Droplet requires looking beyond the sticker price, because cheaper self-hosting often trades lower upfront cost for hidden time and risk. DigitalOcean's Managed Database Basic tier (1 vCPU, 1 GiB RAM) runs $15.15/month for PostgreSQL and MySQL, Valkey (the new name for Managed Redis after Redis license changed—API/commands still compatible) at $15.00/month, and MongoDB at $15.23/month. Extra storage beyond the quota costs $0.215/GiB/month. For comparison, self-hosting on a nearby Droplet—say Basic 2 GiB/1 vCPU at $12/month or 2 GiB/2 vCPU at $18/month—appears cheaper per-month. But Managed Database includes automated daily backups, automatic security patches, built-in high availability (standby nodes on paid tiers), and database-specific monitoring. Self-hosting means you manage pg_dump or mysqldump schedules via cron, apply patches manually, set up replication yourself, and monitor database health independently. That ops work has real cost in engineering time even if it doesn't show on the bill. Decision rule: for production databases your business depends on, or teams without dedicated database operations people, Managed Database's $3–6 monthly premium usually beats the risk of data loss or downtime from missed patches. For dev/staging environments or side projects where your team already does database operations, self-host on Droplets for lower cost and full config flexibility.
- Managed DB Basic tier: PostgreSQL/MySQL $15.15/month, Valkey $15.00/month, MongoDB $15.23/month (1 vCPU/1 GiB RAM); extra storage $0.215/GiB/month.
- Self-host on Droplet at $12–18/month looks cheaper on paper but excludes automatic backup/patch/HA—you do it all.
- Managed Redis became Managed Valkey (license fork, API-compatible); self-hosted Redis on Droplet stays called Redis.
When to Apply These Techniques (Real Use Cases)
The cost-cutting techniques described all have different payoff timing depending on how you run your infrastructure. Small teams with just a few Droplets might get by checking right-sizing and setting Billing Alerts once a month by hand—low enough volume to audit manually. For agencies or teams managing Droplets across dozens of customer accounts, automating Snapshot, Volume, and Reserved IP scans via doctl scripts run weekly delivers much higher return, because the small per-account waste compounds into real money when multiplied across many accounts. Dev and staging environments used only during working hours gain immediate value from per-second billing: run a script to destroy Droplets at end-of-day and recreate them from a Snapshot at start-of-day, paying only for actual usage hours instead of 24/7. This works well if your CI/CD pipeline already has destroy/recreate steps wired in. Database architecture decisions—whether to adopt Managed or keep self-hosting—make sense during system redesigns or when you start hitting downtime from unpatched databases. Reserved IP audits fit best after migrations or decommissioning old infrastructure, when orphaned resources often linger. Use this timing mindset: small teams, monthly manual spot-checks; large operations, weekly automation; architecture changes, one-time analysis; cleanup windows, post-migration checkups.
- Small teams with few Droplets: monthly manual right-sizing and Billing Alert review is enough.
- Agencies managing many customer accounts: run doctl scripts weekly to scan Snapshots/Volumes/Reserved IPs.
- Dev/staging used office-hours only: destroy and recreate from Snapshot on schedule to pay per-hour, not 24/7.
- Database architecture decisions: compare Managed vs self-host when redesigning or after outages from missed patches.
Common Mistakes and How to Fix Them
The most common mistake is deleting a Droplet without first checking if Volumes are attached. DigitalOcean doesn't auto-delete Volumes on Droplet deletion to prevent accidental data loss; Volumes persist and keep charging $0.10/GiB/month afterward, unused. Always run doctl compute volume list after every decommission as a standard step, not just deleting Droplets and moving on.
Second mistake: confusing Basic and General Purpose (Dedicated CPU) Droplets. Both can have similar RAM levels at different price points; picking Dedicated CPU when your workload is just a standard web app wastes money starting at $63/month even for modest specs—far more than a comparable Basic tier. Always verify the slot name before creating.
Third: leaving Reserved IPs unattached for weeks after testing. Each unattached IPv4 costs $5/month silently; if you have multiple orphaned IPs, that adds up fast and doesn't show up in the Droplet List at all. Check quarterly.
Fourth: never setting Billing Alerts from the start, then discovering the overage at month's end when it's too late to fix. Fifth: underestimating storage growth on Managed Databases. Storage overage costs $0.215/GiB/month; if data balloons faster than your plan, that add-on can exceed your monthly base fee.
- Delete Droplet → check doctl compute volume list for orphans; Volumes aren't auto-purged and cost $0.10/GiB/month.
- Confuse Basic vs Dedicated CPU: spot the slot name before creating—Dedicated CPU costs $63+/month vs Basic's lower tiers.
- Forget unattached Reserved IPs for weeks; each costs $5/month hidden from Droplet view.
Best Practices
The most sustainable approach to controlling DigitalOcean costs is making audits repeatable routine, not one-time manual hunts. Start by tagging every Droplet, Volume, and Snapshot at creation time by team, environment (dev/staging/prod), or project. Then filter reports easily, e.g., doctl compute droplet list --tag-name env:staging --format Name,Memory,VCPUs to see only the Staging group.
Build a monthly checklist that bundles everything mentioned: check CPU/RAM utilization against Droplet size, scan for Volumes and Snapshots with no owner, check for unattached Reserved IPs, verify Billing Alerts still match current budget, and reassess whether self-hosted databases should become Managed. For teams with large resource counts, combine those doctl commands into one script and run it via cron or CI schedule instead of manual monthly review—saves effort and catches more.
Also max out free features already in the platform: VPC and Cloud Firewall are completely free and should be standard on every Droplet before you add external security tools. Monitoring includes 1 free Uptime Check per account; use it before buying external monitoring. Static websites should consider App Platform's Free Tier—3 free static sites—instead of spinning up extra Droplets; far cheaper for workloads that don't need a backend.
- Tag every Droplet, Volume, and Snapshot at creation—by team, environment, project—for easy doctl filtering later.
- Build a monthly checklist: right-sizing, stray Volumes/Snapshots, unattached Reserved IPs, Billing Alert review, self-host vs Managed DB reassess.
- Combine doctl commands into a script and run via cron or CI instead of manual monthly checks for large estates.
- Enforce VPC and Cloud Firewall (both free) on all Droplets before adopting paid security tools.
- Static sites should use App Platform Free Tier (3 free apps) instead of extra Droplets.