Managing your spending in the cloud
Adapt your technology operations, finance models and cost optimisation techniques to get the most out of the public cloud.
In most circumstances the public cloud provides better value for money than on-premise technology, but the way you’re charged is different. Your bills will change according to your usage and though long-term costs are often lower, monthly costs could increase or decrease significantly as your demand fluctuates.
This means you need to be flexible in how you budget for cloud services, put in place systems and processes to monitor your spending, and design your applications to take advantage of the cloud cost model.
Building up a comprehensive picture of your ongoing cloud spend will help you avoid unexpected ‘bill shock’ and make it easier to continually carry out cost optimisation so that your cloud infrastructure remains as efficient as possible.
The benefits of the cloud cost model
Moving to public cloud often requires a shift in mindset for organisations that are used to the static hosting costs of traditional data centres and software delivery models. However, accepting greater uncertainty in expenditure can offer significant flexibility and, when managed properly, better value for money. With the pay-as-you-go cost model, you can:
- make use of the latest technology and services as soon as they are available
- alter your technical architecture quickly if your strategy changes
- take advantage of world-class managed services and security capabilities
- continually optimise costs for your services
- avoid up-front costs
- host non-production environments in less resilient or cheaper places
- experiment and test different approaches to the same problem without commitment
- avoid extensive future capacity planning exercises
- check your spending at any time, and set alerts to find out if it changes
- stop your spending immediately if business priorities change
- automate disaster recovery at a much lower cost
Adapting your business, finance and technical operations to take advantage of these benefits will mean that your technology infrastructure is more flexible and more responsive to the needs of your organisation.
Setting up your organisation to take advantage of the cloud
To get the most value out of your cloud infrastructure, you may need to change the composition and practices of your delivery teams.
On their own, commercial and technical teams do not normally have the right oversight and capability to properly optimise cloud costs. For example, commercial teams may be responsible for managing the bill but do not have the technical skills to reduce costs, while technical teams have the ability to reduce costs but not the commercial experience to manage the bill.
It can help to create a central cloud operations team in your organisation. This multidisciplinary, cross-functional team should include technical and commercial specialists, and would normally be made up of a mix of architects, analysts, economists and technical accountants. It should also include people from operational delivery teams who use your services on a daily basis.
A cloud operations team can set policy and create guidance for all the cloud teams within your organisation and can take responsibility for:
- monitoring usage
- billing
- identifying areas where savings can be made
These can be reported back to delivery teams to encourage them to bring down costs, or used to set rules for the entire organisation to help control spending.
Since it’s easy to create an account with a cloud provider and quick to start building a project, you can end up spending more than you intend. Individual services might prioritise speed of delivery over coordinated, longer term savings, but it can lead to a greater consumption of cloud services overall for an organisation.
Your central cloud operations team can work with existing technical design authorities to prevent this behaviour.
You should also try to encourage users, such as architects and developers, to consider the financial impact of the services they build. The decisions they make every day will directly affect the amount you spend on the cloud.
Small decisions, such as whether to store data on a volume attached to the server or in a dedicated managed service, will affect what you pay. This means that to get the most efficient cloud services, developers and architects should work with commercial colleagues and economists to understand the financial impact of their technical decisions. Including cost considerations in architectural planning decisions is the best way to make sure you have the most efficient cloud bill.
This approach can have a big impact, such as when the Home Office reduced their cloud bill by 40%.
How the cloud changes your technology budgets
A private data centre typically requires up-front investment and regular maintenance that is budgeted as capital expenditure (this is often called capex or CDEL). But with cloud, the low initial investment and changeable nature of the billing means it is normally counted as operational expenditure (opex or RDEL). This means when you migrate to the cloud you might also need to reassign your capital expenditure to operational in your hosting budgets.
Many cloud providers offer buying mechanisms that can help to make spending patterns more closely reflect typical capital budgets. These can include large up-front payments or pre-committing to usage for several years in advance.
You might find mechanisms like these helpful for budgeting, but be aware that they can limit your technical flexibility and prevent you from using some of the more innovative features of the cloud. They can also make it difficult to cost optimise later on as you have already committed to a spend level which cannot be reduced.
It might be a better long term decision to work with your finance team to reassign the expenditure as operational. This will help you take full advantage of the flexibility of the cloud billing model.
Make sure you engage with them early so you do not reduce the options available to you. You can find more information on budgetary control and departmental expenditure limits (DELs) for both capital and revenue (capex and opex) in the Government Functional Standard - Finance.
Use spending information for better forecasting
Public cloud services are normally billed by usage. Cost is often calculated by time (usually seconds) or by number of transactions. The way that you store your logs, the database technology you choose, the type of encryption you use and even the country you host in will affect the price. This means it is harder to accurately forecast the short-term costs of cloud than in a private data centre or in older types of software.
However, the advantages of cloud technology are so significant that organisations should accept the extra effort needed for accurate forecasting and take the necessary steps to accommodate more uncertainty in their short-term spending.
Understanding what’s running in your cloud infrastructure will make forecasting much easier and more accurate. Everything you do and build on the cloud is tracked and all large cloud providers have built in tools that help you monitor and forecast your cloud spend.
Many of these suppliers will recommend optimisation techniques which you can apply to your service. There are also a large number of third-party vendors and open source products that can provide detailed dashboards and automated reporting on your cloud spend. Bear in mind that this kind of logging and analysis usually costs extra, so make sure to include it in your organisation’s cloud spending budget.
One of the most powerful ways to get detailed spending information is for your central cloud operations team to create and implement a metadata tagging policy. Good tagging practices enable your organisation to attribute and charge back cloud spending to the right teams, cost centres, projects and programmes.
Understanding who is responsible for each part of your cloud bill is crucial for both forecasting and optimisation techniques to work. Providing teams with the right data will also help them identify unnecessary or excessive usage. This will help teams to optimise their cloud services.
Even though it may be harder to forecast your usage ahead of time, over a longer period you should start to be able to identify trends in the demand for your cloud services that will affect your spending. For example, if you usually have a big spike in activity at the end of the year, you would expect to see a higher bill for December and a lower bill for the rest of the year. Once a service has been live for a while, you can more easily predict the cost profile as there are fewer architectural decisions to be made and you will have more statistics for the number of users.
As spend forecasting is more difficult in the cloud, you should only dedicate a proportionate amount of effort to it. If you find you’re spending a lot of time trying to improve the quality of your forecasting with diminishing returns, you may benefit from greater focus on optimising your cloud spend.
Focusing on cost optimisation
Cloud cost optimisation is the process you can use to:
- identify and eliminate underused resources
- regularly match system usage to your needs
- manage teams to encourage cost savings
- avoid unintended spend (‘bill shock’) with analytics and infrastructure monitoring
Public cloud gives you the opportunity to continuously refine and improve how you consume services, so you use them as efficiently as possible. By only paying for what you use and only using what you need, you can get better value for money in the cloud than you can with a traditional data centre or software model. But if you do not optimise your cloud in this way, you risk paying for inactive or underutilised resources.
Because the cloud charging model allows you to review the billing at any time, you should build a process to regularly review and optimise the cloud costs in your organisation. For example, a mid-monthly check on spending might become part of all teams’ sprint cycles, enabling them to continuously improve the services they use. Similar to the Home Office approach, you may choose to use dashboards and efficiency ratings to gamify the process so that teams can see how their performance compares with others in the organisation.
Optimising cloud costs also saves you money by reducing the amount of electricity associated with running your services. This means it will help to improve the sustainability of your hosting and cut carbon emissions, in line with the Greening Government Commitments.
Common cloud purchasing options
There are 3 main cloud purchasing options you can consider for Infrastructure as a Service (IaaS) and Platform as a Service (PaaS).
Pay-as-you-go
Pay-as-you-go is a pricing option that charges you for services as you use them. If managed properly, this gives you the flexibility to start and stop using resources without termination fees or long-term commitment. This can help reduce the risk of commercial lock-in, where contractual constraints make it difficult to switch providers or stop using a service.
Excess capacity
Depending on the provider, excess capacity is also known as ‘spot instances’, ‘per-second billing’, ‘low- priority virtual machines or ‘preemptible virtual machine instances’.
Excess capacity is where providers offer high discounts on cloud servers that are not currently in use. It lets you rent servers at a very low price, but the risk is they may be taken away at short notice. This option is best for workloads that are not critical or time sensitive and that you can pause, such as batch processing or development environments. You might need to undertake considerable technical work to make this option suitable for services that need to run continuously.
Up-front payments
Up-front payments, sometimes called ‘committed use’ or ‘reserved’ instances are purchasing options that give you guaranteed access to compute for fixed periods of time, usually for between one to five years. Up-front payments are usually offered at a discounted rate, but often lock you in to that rate for the duration of the contract or limit your ability to change instance type.
Because you have to commit to a level of usage, the best use-cases for up-front payments are applications that are continuously running, stable and have a high usage rate. Where usage is variable or unpredictable, they are an inefficient way of using cloud services because you must pay for them whether you use them or not. Also, by choosing a fixed price you will not get the opportunity to use the latest discounts, technology or upgrades that come with other purchasing options.
It is often possible to achieve bigger savings by optimising the pay-as-you-go option and excess capacity services and only using up-front payments on resources you are not able to optimise further.
Techniques you can use to optimise your cloud
One of the biggest benefits of the cloud billing model is the flexibility to change your services without up-front cost or commitment. As new services and tools are released, you should review your current optimisation techniques to check that they still meet your needs. Doing this will ensure you are using the cloud in the most efficient way possible.
Listed here are some of the most common and effective cost optimisation techniques that organisations use.
Architect efficiently
When you’re planning to migrate a service into the cloud, you should optimise your architectural design to take advantage of the benefits of the environment you’re using. This will ensure you make the best use of the service’s native capabilities. When you lift and shift legacy services, your existing service is built to run somewhere else, and is probably not designed to take advantage of the cloud cost model. Things you can do include:
- redesign your service architecture to better fit a cloud-native model, for example by making it a 12 factor app
- use cloud-native products that can do service management for you
- compress storage data if you will not be using it for an extended period of time
- reduce the amount of unnecessary billable network traffic
- run less resilient or cheaper non-production environments
- manage your service’s lifecycle, removing obsolete functionality to reduce sprawl
Use the cloud’s flexibility
Instead of estimating the resources you need, you can use the cloud’s costings flexibility to only pay for what you use. Rightsizing, autoscaling and scheduling your services properly can lead to significant reductions in your bill. To achieve those reductions, you can:
- identify and rightsize underutilised instances to match server capacity with demand
- use smaller instance sizes with less monitoring in non-production environments
- automate the switching between instance sizes
- deploy autoscaling to dynamically increase or reduce the number of servers you have switched on
- switch off non-production environments outside working hours
- only run test environments during active testing
- use provider tools to identify efficiency opportunities
There are also commercial techniques that can take advantage of the cloud’s flexibility. For example, you might reduce your overall licensing costs by tailoring the software licences you buy to the specific resources you have deployed.
Choose the best value resources
Many cloud providers offer tiered resources so you can use different levels based on your requirements. By making sure you use the best value resource for your needs, you can minimise the costs you pay for that capability. You can do this by:
- increasing your usage of excess capacity services
- migrating to use managed services or serverless products when they are cheaper
- automating storage lifecycles to move infrequently accessed storage to cheaper tiers
- turning off enhanced logging and monitoring when it’s not needed
- using instance types that are optimised to your workload, such as with more memory or more CPU capability
- setting alerts for crossing predetermined spend thresholds
- exploring whether hosting in a different region could reduce costs
Stop paying for it when you’ve finished using it
One of the benefits of using the cloud is you are not commercially locked in to using the product. Once you stop using something, make sure you switch it off so you can stop paying for it. It is easy to overlook unused resources, so it’s important to automate this process where possible, and regularly check for forgotten tools. You can do this by:
- building a process to identify and automate the removal of idle or unused resources
- deleting unattached storage volumes, or moving them to a cheaper tier
- removing idle load balancers, or API gateways
- removing resources after you’ve finished testing or prototyping
- removing unattached IP addresses, interfaces or network connections
- removing or compressing old snapshots or backups
Commit resources for mature services
The more mature your service is, the more predictable your bill is likely to become. For stable applications or services, many providers will offer you the option to reduce your bill by committing to the resources you know you will use in advance in exchange for discounts. You can do this by:
- increasing the reserved instance coverage, which involves making an upfront commitment at an instance level
- considering wider upfront commitments, such as contract-wide volume commitments
- making use of available upfront payment options on things such as reserved instances and/or contract-wide commitments
- merging multiple database instances to sit on a larger, single database where the data is not sensitive
- merging multiple compatible database instances to sit on a larger, single database where the data is not sensitive
Similar to using reserved instances, be aware that committing to usage can restrict your ability to use other cost optimisation techniques. For example, you might not be able to optimise your usage by moving to a smaller server because you are committed to using a bigger one. You should only commit to resources when their usage is stable and predictable. These restrictions do not exist in high level contract-wide volume commitments.
Forecast growing your cloud usage
If you expect to grow your use of a supplier’s cloud over the term of an agreement, you can make a commitment to the supplier to grow or exceed their resource use. If you do this, always seek to get an all ‘overage’ (the surplus over the estimated use) discount.
Forecast maintaining your cloud usage
If you expect an unchanging or stable use of a supplier’s cloud over the term of the agreement, you will find less value in discounted overage. With this approach you might find more flexibility and cost savings on the minimum spend commitment required to unlock a specific discount.
Forecast your need for flexible usage
If you need the flexibility to decrease use of a supplier’s cloud, you should carefully consider whether to make any contract-wide spend commitments, particularly if those commitments require any growth in usage. You can still benefit from a cloud pay-as-you-go approach if you join this with smaller associated commitments rather than a contract-wide commitment. For example, reserved instances or other committed usage plans.
For more information on cost optimisation and managing your spending in the cloud, contact cloud-strategy@digital.cabinet-office.gov.uk.
Related guides
Policies and guidance available includes:
Updates to this page
Last updated 15 July 2021 + show all updates
-
Addition of some information about pay model options to the section - Commit resources for mature services.
-
First published.