DEV Community

vangap
vangap

Posted on

AWS vs Digital Ocean cost comparison in 2022

I am a long term AWS user and I always have had this impression that people primarily pick digital ocean because it's cheaper. I recently got to work on a Digital Ocean(DO) deployment and did the price comparison. My observaions were surprising and results are not what I expected.

Assumption for this comparison:

  • AWS Mumbai region (AWS pricing is different in different regions)
  • Compute is the primary cost contributor.

The smallest droplet/instance on DO costs $4 which comes with 512 MB RAM and 1 vCPU and a 10 GB disk space. On the other side, we get a similar instance t4g.nano for $2 in AWS Mumbai. If you look at the prices in DO or AWS, these prices scale linearly as we move to powerful instances. So, this comparison holds true for both small and large instances. If we include the disk space cost which AWS charges separately, we need to do + ~$1 to the costs assuming that we are using 10GB volumes. Now, as we move to larger instances this disk space cost becomes insignificant.

One could say that there could be differences in the exact hardware that these cloud providers use and there could be differences in how much performane these can output. So this is not exactly apples-apples comparison and it will never be.

DO documentation says that the general purpose droplets use first generation or older Xeon Scalable processors. While it is not crystal clear, AWS documentation hints that it uses similar processors for it's t3 generation instance types. So, it is fair to say that the latest t4g instances built on top of AWS's custom ARM processors, which are supposed to be up-to 30–40% cost efficient would fare better than corresponding droplets.

Even if I pick the default US East region, t4g.nano costs $3+$1 (including disk costs) which is same as DO. I am ignoring the data transfer limits that DO offers along with the droplets which is also considered in its cost. If the requirement is pure compute, you rarely need more storage than 10 GB for your stateless applications. And, I agree that data transfer can be a factor for some use cases while for others it will be negligible.

On top of this, few other AWS features can optimize the costs further:

  • Reserved instances
  • Spot instances
  • Auto scaling, Scheduled scaling

Reserved instances provide compute at up to 40% lower costs. If you know that you are going to need the servers for an year, you can make a commitment to AWS that you will use those instances for an year with no upfront fee and get ~37% discount. This is sort of like taking an yearly subscription and paying monthly.
There is also some flexibility that comes with reserved instances that let's you change the instance configuration after comittment. For example, if you reserve two instances with 8 GB RAM and later need to use instances with 16 GB RAM as your load increased, you can convert these two 8GB instances into one 16GB instnace. In essence, you are only committing to use a fixed number of RAM and CPU cores of a particular generation(t3, m5 etc) of instances, actual instance types can be changed as per your needs.

Spot instances provide compute at up to 70% lower costs with downside of instances being taken away at any time based on demand and supply. If you have a resilient application that can tolerate some failures or a background processing task that is not user facing or not time critical workload, you can choose to use spot instances.

Auto scaling lets you scale in/out your servers based on various conditions. So, you could choose to have a minimum capacity as default and let AWS scale it up automatically when needed. You could also schedule the scaling events based on time (For ex: scale to 2x servers during peak times and back to normal during normal hours)
There are also other benefits that come with AWS like better eco-system of tools and developers which can decrease the TCO (Total cost of ownership)

What about services other than compute?
Interestingly, EC2 seems to be the only service where AWS Mumbai is cheaper. Even with a slightly higher price than other regions, storage costs $.025 / GB in AWS while it costs .02 / GB in digital ocean. That is AWS being 25% costlier.

Managed Redis on DO costs 0.02232 while it costs about 0.02 in AWS Mumbai.
Digital ocean offers some amount of free disk space and data transfer while AWS doesnt' do it. AWS has free tier for data transfer to some extent though it is not per instance, it is global limit.

When to pick AWS?
Most AWS regions have EC2 prices same or lower than DO. Managed services(Postgres, Redis etc) price seems to be comparable to that of correspodning digital ocean offerrings.
If your primary cost contributor is not data storage and data transfer(i.e you are not delivering media files or letting users download large data files), AWS seems like an obvious choice. This wasn't the case always, AWS has been introducing newer and cheaper instances over the years. AWS Mumbai used to be one of the costliest region a few years back and is the cheapest now.

One other thing to note is that there are a lot of nuances around data transfer costs in AWS. For ex, you could get charged for the data you are reading from your databaes depending on the available zone differences. So, these could unexpectedly lead to higher costs.

Now, I would like to hear about the reasons you might want to use Digital ocean over AWS?

  • Is it simple to use and less overwhelming for beginners?
  • Is the pricing simple to understand and predictable while AWS charges for a lot of things separately, especially the data transfer costs which are not obvious to reason for beginners?

Top comments (0)