Cost optimisation in public clouds
Public cloud can easily cost more than on-prem
7 min read
Public cloud is a type of cloud computing that delivers shared computing resources and data over the internet on a pay-as-you-go model. It allows organizations to access and utilize computing resources, such as servers, storage, and databases, without having to invest in and maintain their own infrastructure. Public cloud services are provided by major technology companies such as Amazon Web Services (AWS), Microsoft Azure, and Google Cloud Platform (GCP).
Cost control is a critical aspect of using public cloud services as it directly impacts the overall budget and profitability of an organization. With the pay-as-you-go model, organizations only pay for the resources they use, but without proper management and optimization, costs can quickly spiral out of control. This is especially true for organizations that have a high degree of variability in their workloads or are experiencing rapid growth.
In this article, we will discuss how cloud costs may easily get more expensive than on-prem ones. We first look at the various pricing models of public cloud services and then look at some of the actions/inactions that can lead to higher costs and how to mitigate them.
Understanding Public Cloud Pricing
Understanding Public Cloud Pricing is an essential step in controlling costs when using public cloud services. The three main pricing models for the public cloud are pay-as-you-go, reserved instances, and spot instances.
Pay-as-you-go: This is the most common pricing model. Organizations only pay for the resources they use, such as computing power, storage, and data transfer. This model is ideal for organizations that have a high degree of variability in their workloads or are experiencing rapid growth.
Reserved instances: This pricing model is similar to pay-as-you-go, but with a commitment to use a certain amount of resources over a specific period. Organizations that know they will need a certain amount of resources over a long period can save money by purchasing reserved instances.
Spot instances: This pricing model allows organizations to bid on spare computing capacity at a discounted price. This is ideal for organizations that have flexible workloads and can stop or start instances as needed.
On-demand pricing: This pricing model is similar to pay-as-you-go but with no commitment. This is ideal for organizations that have a predictable workload and want to avoid long-term commitments.
Organizations need to understand these pricing models and choose the one that best suits their needs. Additionally, it is also important to regularly review and optimize resource usage to ensure that costs are kept under control.
Cost control challenges
Given all the benefits of public clouds, why then would they cost more than on-prem data centres and services? Many organisations, especially small ones, move to the cloud without a strict policy of cost optimisation. This can result in heft bills and make an organisation reconsider whether using a public cloud is the right strategy in the first place. There are cases, however, where cost optimisation has been front and centre but still faces prohibitive costs. One example of such can be found here. This article is not intended to address such scenarios. It is intended to encourage organisations to plan and strategise for cost optimisation. Let's look at areas that can be costly and how to address them.
Not right-sizing resources: A key feature of public clouds is the elasticity of resources. If you are migrating from on-prem and running a service on a 1TB RAM machine with 32 cores, do you need to have the same spec in the cloud? Once such a server is provisioned, you pay for it whether in use or not. To optimise cost, analyse how your service is currently used. If memory and CPU usage demands fluctuate depending on the time of day, week, month or year, it may be optimal to provision a server with minimal specs and scale up and down based on demand. Another consideration is to analyse whether it is possible to decompose your service into several smaller services that require a lot fewer resources and yet still can scale up or horizontally when required. This means using the right amount of resources for each workload and not over-provisioning.
Lack of automation: Managing cloud costs require ensuring that the right amount of resource capacity is available for a given task. This entails reporting on resource under/over-utilisation and making adjustments accordingly. Automating tasks such as scaling up or down, monitoring and reporting can help organizations save money by reducing manual errors and inefficiencies.
Not taking advantage of long-term commitment: For organisations that have a medium to long-term budget for cloud usage, they can save money by entering into a long-term commitment with a cloud provider. Reserved instances are a pricing model in cloud computing that allows customers to reserve capacity in advance for a discounted price. With reserved instances, customers can save money on their cloud computing costs compared to using on-demand instances. In the case of Amazon Web Services (AWS), reserved instances can be purchased with one- or three-year terms, with the option to make partial or full upfront payments, to receive even greater discounts. In Azure, reserved instances are called "Reserved Virtual Machine Instances (RIs)" and they allow customers to save money on virtual machine costs by committing to use virtual machines for a one- or three-year term.
Not taking advantage of low-cost options: Cloud providers offer pricing tiers for most resources. Organizations that have flexible workloads can save money by using the cheapest tier wherever that is possible. For example, AWS spot instances (low-cost VMs for Azure) that run on spare computing capacity at a discounted price. This can be an effective strategy, especially in lower environments where consistent performance is usually not required.
Optimizing data storage: Public cloud providers offer a range of storage options, each with different costs. Organizations should choose the right storage options for their data and regularly review their usage to ensure they are not paying for unnecessary storage. Most cloud providers offer different storage tiers that are optimal for specific use cases. Understanding the use case of your data will help in choosing the right tier for your storage.
Lack of monitoring and reporting: Regularly monitoring and reporting on resource usage can help organizations identify and address any issues that may be driving up costs. Without monitoring and reporting, it is impossible to figure out which resources are the major cost contributors. It is important to ensure that reporting is granular enough to be able to drill down individual teams or business areas and specific resources. This can highlight resources that have wrongly been provisioned or are not in use anymore.
Lack of policies: The ease with which resources can be provisioned makes controlling costs challenging. In on-prem environments, teams will normally raise paperwork that usually would have to go through many approvals before new resources can be provisioned. This is no longer the case with public clouds; they make it easier for developers and teams to provision resources within minutes by running a few commands on a terminal. This is where policies become important - to limit what can be provisioned. For example, you can put policies in place that limit the size and power of VMs that can be created in development environments. You can also limit what type of resource tier (free, standard or premium) can be provisioned. The goal is to minimise costs by only provisioning resources with the right capacity and tier for a given use.
In summary, controlling costs in public clouds is an important aspect of using these services. Key strategies for controlling costs include right-sizing resources, automation, reserved instances, spot instances, optimizing data storage, monitoring & reporting and policies.
The ease with which resources can be provisioned can easily result in expensive bills. Having policies in place to control what can be provisioned in what environment is key. Even with policies in place, organisations need to continually monitor and report on cloud resource utilisation and cost. This will enable continued optimisations possibly through refining policies and user education.
Even before embarking on a cloud journey, organisations need to analyse their existing environments and plan their migration taking advantage of cost optimisation options available in public clouds. As cloud architects, our role is to architect solutions that are fit for purpose while minimising costs. It is not our goal to use the latest and greatest but advise organisations on what is best for them given their workloads.