{{announcement.body}}
{{announcement.title}}

How to Hack Your Cloud Costs

DZone 's Guide to

How to Hack Your Cloud Costs

The complete guide to reduce cloud costs without sacrificing performance.

· Cloud Zone ·
Free Resource

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 by 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 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.

Part 1 :  Server Costs

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. Finally, we'll review some business options to obtain significant discounts on cloud spending.

Turn Off Servers

Estimated discount — 15% of total server cost

  • Turn off servers that are not being used.
  • Sizing — Adjusts the size of the server to the amount and usage load.
  • Restrict user permissions to create new servers.

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:

  • Replace the commitment with a different type of server
  • Cancel the RI and pay an exit fine

From a calculation I made for Azure, it is more profitable to commit to three years with a 60% discount and cancel after a year with a 12% penalty than to commit to 40% per year (per server size).

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:

  • Running stateless services that are not critical; if they close, you can always turn them on again (the disc is not deleted).
  • Working with a queue; if a server closes, the task will remain in a queue and wait for another server.
  • Use auto scaling rules to automatically handle a particular instance count if a spot server is closed.
  • A company called Spotinst helps reduce costs by effectively using Spot. They are able to identify spot servers that are about to close and replace them with other spot servers with virtually no downtime. From an inquiry I made, it seems that their Azure support is still incomplete (Azure K8s service is not fully supported), but AWS is better supported.

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 ensure 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 Coverentis 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 environments 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 like Skeddly and Parkmycloud.

Part 2 — Storage and Network

Storage

Estimated discount — 20% of storage costs

Here are the top five cloud storage categories ordered from low cost to expensive (from slowest to fastest):

  • Archive storage
  • Object storage
  • File storage — Network libraries that can be mapped to multiple servers
  • Block storage
  • Database storage

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:

  • allowing processes to operate within the same geographical area if possible.
  • using only internal addresses.

For external traffic I use Cloudflare, which has the following advantages:

  • DDOS protection
  • CDN — Files are downloaded from Cloudflare servers closest to the client location.
  • Uses “Brotli” compression that is better than gzip.
  • Cloudflare workers — run request logic at a Cloudflare endpoint before the request reaches my network.

Part 3 :  Business Discounts

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 competing external 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:

  • Discounts on the total cost of the cloud
  • Support for malfunctions
  • Architectural consulting
  • Tools for cost management
  • Flexible payment terms

Each of the major cloud providers has more information on this:

Startup Programs

Estimated discount — credit that can reach tens of thousands of dollars or more

All the cloud companies have plans that can benefit start-ups.

The benefits can include:

  • Credit for cloud usage
  • Consulting services
  • Business promotion/accelerator

Each of the major cloud providers has more information on this:

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.

* The topics mentioned above reflect my professional opinion only. I have no affiliation with any of the services mentioned in the article.

Topics:
cloud computing ,aws ,azure ,google cloud compute ,devops ,cost benefit analysis ,multicloud ,cloud management

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}