Azure cost optimization best practices are less of a checklist and more of a series of evolving choices. Moving from on-prem systems to the cloud — even refactoring to more cloud-native architecture — requires your team to make a few shifts in how you think about your systems.
Cost control might not be part of the consideration process for on-prem infrastructure. Just acquiring and setting up new servers can be enough of a barrier. In Azure, though, you can hypothetically access unlimited compute and storage in endless permutations. You just don’t want to pay for those unlimited resources. As risks grow and change, costs change as well, and it becomes necessary to consider cost optimization where you once might only have thought about risk mitigation.
Azure is always growing and changing to anticipate and meet business needs before we have them. That means your Azure cloud strategies need to be constantly growing and changing as well. It’s not an easy one-time setup. Building best practices and keeping costs low consists of a lot of planning and iterating to balance what is needed versus what is cost-effective.
Changing attitudes to optimize cloud costs
Shift the set-it-and-forget-it mindset, and you might start to see other perspectives change. Like how, instead of stifling creative thinking, cloud cost optimization can provide the necessary constraint to kickstart true innovation.
Cost optimization is as much an art as it is a science. Setting up Azure in the way that works best for your systems means taking a nuanced look at numerous factors. It’s a balance of business requirements against optimal costs. The most expensive solution isn’t guaranteed to be the best for you, and the cheapest solution can be unacceptably risky. Finding the sweet spot between those two extremes is the goal of any Azure setup.
Here’s how to achieve it:
- Embracing cloud to achieve Azure cost management
- Azure cost optimization best practices start in setup
- Azure cost management thrives in moments of elasticity
- How reservations brings flexibility to Azure
- The (not-so) secret Azure cost savings: software licensing
- Keeping Azure cost management top-of-mind when (re-)architecting
Embracing cloud to achieve Azure cost management
When you are contemplating services in Azure, the closer you get to a pure cloud experience, the more optimized your costs will be. A Software as a Service model — where your infrastructure is fully managed by a cloud partner — will unlock all of the efficiencies cloud can offer for cost, storage and scale. When you approach your Azure instances with the same framework you use for on-prem servers, you’re limiting what cloud can do for you.
Managed infrastructure reduces the risks of human error while automatically shifting resources to the most efficient and cost-effective configuration. In fact, if you go fully managed with your infrastructure, Microsoft will handle the setup and tune the automation to maximize your efficiency — meaning you can skip the better part of this article altogether.
For those somewhere between IaaS and SaaS, however, there’s still a lot you can do to set up your Azure cloud for optimization and growth. Let’s take a look at the steps, hurdles and forks in the road to a cost-optimized Azure system.
Azure cost optimization best practices start in setup
Historically, on-prem IT systems created a bottleneck. Only the IT team could set up new resources, giving it veto power over any out-of-the-norm requests. The cloud makes infrastructure more accessible, even self-service.
It’s great news for innovation — now any team can chase down ideas and create testing environments — but it can be bad news for budget if anyone can spin up resources. The answer is governance. A smart policy, even a policy as code, sets the guardrails controlling both risk and cost, without requiring any human to play traffic cop or slow things down.
Policy can also drive the conversation about what is kept — not just created. Identify unused or highly underutilized resources at the start of your project. It will help you determine what does not need to move into the cloud, and it might illuminate trends in how your capacity has grown unwieldy over time. In this way, it’s not too different than a pre-move garage sale, identifying what you have, what it’s worth and what you want to take with you.
In the process of establishing which elements are unused, you’ll also get a sense of what is used often. This will give you the ability to understand the workload trends and patterns that are necessary for stable daily operations. To get the full picture you will need to use configuration tools to analyze and measure system metrics, then interview workload owners to understand context and factor in seasonality. Usage may go up and down over time, or be critical in one part of the year and not in another.
Choosing the right resource types and tiers for cost optimization
Your findings will inform how your system is architected. Azure is full of different resource types and tiers, and choosing the correct ones for your needs is one of the quickest ways to optimize cloud costs. We can illustrate it best when considering options for virtual machines:
- Should I use general purpose or memory-optimized?
- Can I leverage burstable VMs to save money?
- Why would I use a vCPU-constrained size?
- Would my app’s architecture support spot virtual machines?
All of these options have their own positives and negatives for how your system and your employees operate best. If you focus only on the lowest cost, you’ll use burstable compute for everything. It seems like a great deal, but any Azure advisor will tell you it can lead to problems when not configured for the correct type of workload.
CPU constrained, on the other hand, may seem like a bad deal on its face. Why pay the same price but disable some of the vCPUs/cores in the system? In this case, the benefits of licensing strategy can actually save you money in the long run. If you have a memory-hungry workload, for example, you may need a VM configuration that Azure doesn’t offer — like 128 GB of RAM without the 16 or 32 cores that typically come with it. By using a vCPU constrained size, you can get the memory or other performance specs you need, but only license 8 of the cores, potentially halving your licensing costs.
Other methods have their moments as well. Spot Virtual Machines can provide huge cost-savings, but should only be considered for low priority, interruptible workloads.
Azure cost management thrives in moments of elasticity
Opening your business up to all that cloud can offer is a mindset shift, but one that comes with serious benefits. When all of your storage is in physical hardware on-site, you need to overshoot your storage needs and capacity limits. Scaling up takes time — to get new servers to your location and to manually set them up. You have to plan well in advance for any growth.
Azure infrastructure lets you scale your systems when needed — so you’re not paying for unused storage or throttling users when you hit the limits of what you have. This lowers your up-front investments because large amounts of hardware (and room to store and potentially expand that hardware) aren’t necessary. It also keeps you nimble, allowing you to procure and set up Azure resources almost instantly.
One of the biggest benefits of moving to the cloud is the ability to expand when system usage is up and retract when usage is down. Elasticity in cloud capacity is for many companies enough of a reason to switch from an on-prem system.
Azure’s ability to handle unpredictable workloads means your apps and software stay functioning, even if the amount of traffic goes way beyond expectations in a short period of time. It also means you can find yourself paying for much more computing power than you’d planned.
Achieving scale while monitoring Azure costs
To handle sudden boosts in workloads, you must decide when to use horizontal vs. vertical scaling. Where horizontal scaling allows you to spread your load across multiple VMs, vertical scaling keeps your VMs, but puts more or less compute power behind them to manage the load.
Vertical scaling can be simpler, but each shift up or down requires downtime. If your ecommerce site is all of the sudden receiving a surge in traffic, the last thing you want to do is temporarily kick all the users out while you reboot.
Another potential downside of vertical scaling stems from how Azure’s VM sizes step up linearly. If your needs cross the threshold from 16 GB of memory to 17 or 18, the cost difference won’t be fractional, but likely double when you have to jump to the next size up with 32 GB RAM.
With horizontal scaling, it’s possible to more precisely match capacity to demand. If users triple, I can add a few VM instances to quell the swell, then return them when they’re no longer needed. To take the example from above, if memory demand increases from 16 GB to 17 or 18, horizontal scaling might mean increasing the number of VMs with 4 GB RAM from four to five — achieving a marginal cost increase.
Horizontal scaling also enables autoscaling. It’s possible to create some automation for vertical scaling, but since it can introduce downtime, it will never be truly hands-off. If the spike in traffic is a one-time fluke, manually enabling vertical scaling can allow for a quick fix. But if you know your needs will shift somewhat often, autoscaling allows you to build out logic to procure and spin down resources without human intervention, based on factors including:
This will account for seasonal jumps in workload or one-off events that need more cloud capacity than normal operations.
- Performance metrics
You choose which metrics and engage autoscaling, controlling the guardrails by defining necessary CPU or memory, for example.
- Custom metrics
- You can also manage autoscaling by defining the user experience you want people to have. Focusing on user queue length or other app-specific needs will ensure you have the backend resources necessary to deliver your preferred end results.
As you embrace autoscaling and infrastructure as code, moving closer to a SaaS model, you’ll notice a shift in how you think about your servers. Instead of treating your virtual machines like pets — having individual identities and requiring constant attention — you’ll be able to treat them like cattle — able to provide a great outcome for you collectively, but unimportant individually.
Immutable infrastructures, where everything stays static once it’s launched, rely on automation to manage the “cattle.” If needs change, administrators can update the automation logic, then let it roll through the “herd” to replace any server still set to yesterday’s configuration. It also saves administrators the time of troubleshooting — there’s no reason to tend to a server that’s not performing when it can be automatically and correctly rebuilt.
Mutable infrastructures, where servers adapt to changing needs in a more hands-on way, also have their places. In general, immutable infrastructure will be more cost-effective, but it won’t be the right choice in every situation. Having a partner who knows your needs and end goals will help you determine what’s best for your business, and when.
Reservations bring flexibility to Azure usage and cost
Reservations are perhaps the most straightforward Azure cost optimization tool: They allow you to save money on predictable workloads by committing to longer-term usage. Microsoft offers significant savings by reserving Virtual Machine compute for one- or three-year terms.
Reservations in Azure apply to family types. By not committing to a specific VM, it allows you to cover more capacity with your reservations, even if you have a resource with a short life cycle. Many reservations are even flexible enough to allow for exchanges or refunds if you don’t end up using them — though that’s not available in every case.
In general, reservations will allow businesses to cover their baseline usage patterns for a more favorable cost, while still using pay-as-you-go resources for peaks. When debating scheduling versus reserving, an Azure advisor can help you decide when and how to use each resource.
The (not-so) secret Azure cost savings: software licensing
There are many reasons to choose Azure over AWS — and plenty to choose AWS over Azure as well. But the decision is never easier than when you already own Microsoft licenses. Maybe you’re moving from on-prem Microsoft servers to the cloud, or maybe you’ve just decided to buy your own licenses. Either way, if you bring a license in lieu of paying by the minute, you can save a lot.
Like with reservations, there’s a break-even point where purchasing an Azure Hybrid Benefit-friendly license will actually save you money vs. paying as you go over the course of a long lifecycle. Term-based licenses can also be useful in situations outside of migration, such as refactoring or modernizing an application, because they can be applied to both IaaS and PaaS offerings.
Keeping Azure cost management top-of-mind when (re-)architecting
Whether you’re starting fresh in Azure or assessing and adapting applications that have already moved, cost optimization should be on your list of goals. Even if you feel like saving money isn’t a priority compared to reducing risk, considering cost-optimization provides a constraint that can make your entire architecture stronger.
It’s also a way to provide just enough in the way of guardrails to encourage innovation. When anything is possible, often nothing gets done. Creating a little bit of guidance can push your team to think more creatively.
The trick is not to focus too much on the side of standards and templates. You can accidentally limit the functionality of your testing and keep your people from leveraging the full breadth of Azure’s capabilities if you stick too closely to off-the-shelf solutions.
So much goes into creating the right Azure architecture, from your workflow to your availability requirements to your regulatory requirements to your risk tolerance. Cost optimization is another variable to consider alongside them, making sure you’re getting what you need without paying for what you don’t.
Implementing Azure cost optimization best practices is not a small task, and it’s truly never finished. As your company needs grow and change, what works best to keep Azure costs down will too. If you want help navigating Azure and making it work best for your organization, we can help you move closer to a fully managed, fully automated, fully optimized architecture.
Interested in optimizing your costs right now? Get in touch.