One of the primary motivations for using the cloud are flexibility and cost saving. The problem is that without ongoing management and oversight, the cloud budget can grow to dimensions that eliminate profitability.
A recent study on the cost of using the cloud has shown that companies pay an average of 35% more on cloud services than they really should. A total of over $60 billion is being wasted on cloud services that are not in use.
In this article, I will share my conclusions from recent cloud cost optimization processes and review a number of ways and tools to significantly reduce cloud costs 30–50%, without sacrificing performance. The recommendations in this article are valid for all cloud vendors unless otherwise specified.
Tools for managing cloud costs
Before you start saving it is important to understand the cost composition. In each cloud, there are cost management tools that show different segmentation of costs by service type. These tools can automatically detect available servers and recommend that they are reduced or turned off.
Usually, servers are the largest component of the overall cost, so we will start with a number of server cost-saving strategies, then look at how you can lower your storage and network expenses and finally review some business options to obtain significant discounts on cloud spending.
Turn off servers
Estimated discount — 15% of total server cost
Tools for managing cloud costs will help to find which servers should be minimized.
Reserved Instances
Estimated discount — 50% of the cost of long-term servers
Reserved Instances (RI) can significantly reduce server costs, provided you commit to a long term contract (1–3 years).
This program is not suitable for temporary servers that we may not need in the future. Usually, a commitment for a year will give a 40% discount, while a commitment for three years will provide a 60% discount.
If you still want to stop using a server you have committed to, there are several ways to get out of the RI commitment:
From a calculation I made for Azure, it is more profitable to commit to 3 years with 60% discount and cancel after a year with a 12% penalty than to commit to 40% per year (per server size).
https://azure.microsoft.com/en-us/pricing/details/virtual-machine-scale-sets
https://aws.amazon.com/ec2/pricing/reserved-instances/pricing/
https://cloud.google.com/compute/pricing
Spot Instances
Estimated discount — 70% of server costs that are not “mission critical”
Spot servers or low priority servers are 70–90% cheaper than regular servers of the same power! Furthermore, today the discount is fixed (and not by the auction process as practiced in the past).
The catch is that these servers are low priority so you run the risk that they will suddenly close without notice.
Fortunately, there are several ways to deal with this unfortunate state of affairs:
Serverless \ Autoscaling Architectures
Estimated discount — 90% of the cost of servers that are constantly open to load times
Our systems have to withstand heavy loads, but there is no reason to keep all the servers working during periods of low demand.
Autoscaling ensures that the number of servers will automatically scale according to the measured load.
Serverless functions run only as needed without the need for any servers.
Proper architecture is one of the essential elements of an efficient and effective cloud but is beyond the scope of this article. For server architecture and cloud design patterns, in general, see awesome-design-patterns.
In systems managed by Kubernetes, the allocation of resources is usually more efficient and cost-effective. The virtual-kubelet project can connect Kubernetes to serverless containers platforms such as AWS Fargate and Azure Container Instances.
Dev \ Test
Estimated discount — 50% of the cost of low-altitude servers
A large portion of our servers belong to dev, test and pre-prod environments.
In Azure, there are discounts on dev/test environments (I do not know of a parallel program in other clouds).
In many cases we work on dev/test environment during the day only, so servers can be shut down at night and weekends, saving over 50% of the cost. There are tools to shut servers down automatically according to schedule:
Parlmycloud — Servers turn on only at the green slots.
Storage
Estimated discount — 20% of storage costs
Here are the top 5 cloud storage categories ordered from low cost to expensive (from slow to fast):
Within each storage category, there are several price levels depending on speed and redundancy.
Raw data can be stored in a cheap storage category but metadata, used for queries, is best kept in an expensive storage category.
Archive storage is the cheapest form of storage but is not practical for ongoing work due to slow retrieval times. Object storage is the next cheapest storage category. Therefore this is the preferred storage choice for the majority of the data.
You should set up a “Storage Lifecycle” policy that allows you to set rules for automatically moving old files to cheaper storage categories. (Available in AWS and found in preview in Azure)
Network
Estimated discount — 20% of the cost of network traffic
The network traffic consists of internal traffic (within your network) and external traffic between the server and the customers.
For internal traffic I recommend:
For understanding ways to reduce external traffic I talked with John Graham-Cumming , Cloudflare’s CTO, who pointed out Cloudflare’s networking costs benefits * :
*This does not imply Cloudflare is the only vendor in this domain.
Cloud providers and their partners have many programs that can offer significant discounts. Large customers can also bargain directly with cloud providers for discounts.
Even if the whole system is on one cloud, sometimes, in specific areas it is useful to use external providers for services like CDN, DNS or even another cloud in order to lower costs.
Cloud partners
Estimated discount — 5–10% off the total cost + consultation
There is no substitute for consultation from an experienced cloud architect. All the major cloud providers have partners that provide consulting services. Working with them can provide a number of benefits.
For example:
https://partner.microsoft.com/
https://aws.amazon.com/partners/
https://cloud.google.com/partners/
Startup programs
Estimated discount — credit that can reach tens of thousands of dollars or more
All cloud companies have plans that can benefit start-ups.
The benefits can include:
https://startups.microsoft.com/en-us/
https://aws.amazon.com/startups/
https://cloud.google.com/developers/startups/
Free tier programs
Estimated discount — first year free for small servers
All cloud providers have free tier plans. These programs allow free use of the lowest cost services for a year or for a fixed number of uses. There is usually no limit to the number of free tier accounts that can be created.
https://azure.microsoft.com/en-us/free
https://cloud.google.com/free/
* The topics mentioned above reflect my professional opinion only. I have no affiliation with any of the services mentioned in the article.