DigitalOcean’s pricing is remarkably straightforward, but the cost of a seemingly simple Droplet can quickly balloon when you start adding essential services like block storage, floating IPs, and load balancers.

Let’s walk through a typical scenario. Imagine you need a web server, a database, and some persistent storage for your application data.

Here’s a terraform.tfvars file that defines these resources:

region = "nyc3"

web_droplet = {
  name     = "my-web-server"
  size     = "s-2vcpu-4gb"
  image    = "ubuntu-22-04-x64"
  ssh_keys = ["your-ssh-key-fingerprint"]
}

db_droplet = {
  name     = "my-database"
  size     = "s-2vcpu-8gb"
  image    = "ubuntu-22-04-x64"
  ssh_keys = ["your-ssh-key-fingerprint"]
}

app_volume = {
  name = "app-data"
  size = 50 # GB
  region = "nyc3"
}

db_volume = {
  name = "db-data"
  size = 100 # GB
  region = "nyc3"
}

load_balancer = {
  name = "my-app-lb"
  region = "nyc3"
  droplet_ids = [] # Will be populated after web_droplet is created
}

floating_ip = {
  name = "my-app-fip"
  region = "nyc3"
}

This configuration sets up two Droplets: my-web-server (2 vCPU, 4GB RAM) and my-database (2 vCPU, 8GB RAM). It also provisions two Block Storage volumes: app-data (50GB) and db-data (100GB). A Load Balancer named my-app-lb and a Floating IP named my-app-fip are also defined.

Now, let’s break down the costs associated with these resources.

Droplets: DigitalOcean’s Droplet pricing is per hour, with monthly caps.

  • s-2vcpu-4gb (web server): $0.030 per hour. At 730 hours/month (approx.), this is $21.90.
  • s-2vcpu-8gb (database server): $0.060 per hour. At 730 hours/month, this is $43.80.
  • Total Droplet Cost: $65.70

Block Storage: Block Storage is priced per GB per month.

  • app-data (50GB): $0.10 per GB/month. 50GB * $0.10 = $5.00.
  • db-data (100GB): $0.10 per GB/month. 100GB * $0.10 = $10.00.
  • Total Block Storage Cost: $15.00

Load Balancers: Load Balancers have a fixed monthly cost regardless of traffic.

  • my-app-lb: $10.00 per month.
  • Total Load Balancer Cost: $10.00

Floating IPs: Floating IPs are free if attached to a Droplet. If unattached, they incur a small hourly charge. For this example, we assume it will be attached.

  • my-app-fip: $0.00 (when attached).
  • Total Floating IP Cost: $0.00

Total Estimated Monthly Cost: $65.70 (Droplets) + $15.00 (Block Storage) + $10.00 (Load Balancer) + $0.00 (Floating IP) = $90.70

This calculation doesn’t include potential costs for things like outbound data transfer (which is generous but can add up for high-traffic sites), backups, or managed databases.

The most surprising thing about DigitalOcean’s cost structure is how easily the "simple" Droplet price can be misleading. A small, cheap Droplet can become significantly more expensive once you add the necessary supporting infrastructure like dedicated storage volumes or a load balancer to handle traffic.

Here’s how a load balancer actually works with Droplets. When you create a load balancer and attach Droplets to it, you specify a port (e.g., 80 for HTTP, 443 for HTTPS). The load balancer then listens on its own public IP address (or floating IP). When a request comes in, the load balancer distributes it across the attached Droplets based on a chosen algorithm (e.g., round robin). The Droplets themselves don’t need to be publicly accessible; they only need to be reachable by the load balancer within the DigitalOcean network.

Consider this snippet from a DigitalOcean main.tf file that configures a load balancer:

resource "digitalocean_loadbalancer" "app_lb" {
  name = "my-app-lb"
  region = "nyc3"
  forwarding_rule {
    entry_protocol = "http"
    entry_port     = 80
    target_protocol = "http"
    target_port     = 80
    # Droplet IDs will be added dynamically after they are created
  }
  droplet_ids = [digitalocean_droplet.web_droplet.id] # Example, assuming web_droplet exists
}

resource "digitalocean_floating_ip" "app_fip" {
  name   = "my-app-fip"
  region = "nyc3"
  # Associate with the load balancer
  droplet_id = digitalocean_loadbalancer.app_lb.id
}

This configuration defines the load balancer and explicitly associates the floating IP with it. The droplet_ids are crucial; they tell the load balancer which Droplets to send traffic to. You can also configure health checks within the load balancer resource to ensure traffic is only sent to healthy Droplets.

The core idea is that the load balancer acts as a single point of entry, abstracting away the individual Droplet IPs. This allows for scaling, redundancy, and easier management of your application’s availability.

The one thing most people don’t realize is how much outbound data transfer can cost if not monitored. While DigitalOcean offers a generous amount of free outbound transfer per Droplet, exceeding this allowance triggers charges that can significantly increase your bill. For instance, a 4GB Droplet includes 5TB of outbound transfer per month. If your application suddenly experiences a surge in traffic that pushes you over this limit, you’ll be charged $0.01 per GB thereafter. This can add up very quickly for video streaming or large file downloads.

Always check the DigitalOcean Pricing Page for the most up-to-date information, as prices and allowances can change.

Want structured learning?

Take the full Digitalocean course →