Journey to Cost Optimization: An Azure Perspective in 3 Must-Do Steps

By Sergiu Ibanescu

Determining an optimal cost strategy which should not harm operations can be a daunting task. It is not a surprise that Microsoft listed cost optimization as one of the five pillars of the Azure Well-Architected Framework. But not only Microsoft with its Azure cloud model listed this as a pillar, also its direct competitor Amazon registered that in their six pillars of the AWS Well-Architected Framework.

Therefore, we should understand what cost optimization really means and try to compare its trade-offs against the other pillars. But how should we start, where to look and how to make informed decisions? This article tries to unveil some “mysteries” and point you to areas you absolutely must visit before (or during) this journey.

Step 1: Determine the cost

How to start? The first mandatory stop is the Azure Price Calculator. Using this service, you can play around with various IaaS/PaaS options, choosing your region, your size, your currency and simulate various setups. For example, if you want a VM for a long period of time, you can opt for a reservation and dramatically decrease your monthly costs. You can see that with a couple of clicks on the website:

At the end, after you have your simulation done, you can also export that to Excel and use it for further reference.

Step 2: Cost monitoring

Now you have a clearer view on what to expect (financially speaking) and you set some resources. You need to monitor them to avoid some unpleasant surprise at the end of the month (or when your invoice is emitted – which is not necessarily the month’s end). You guessed it, this is the second mandatory thing to have on your radar and there are different Azure services/features which can help you with that:

➡️ Cost Analysis

Part of Cost Management service, Cost Analysis is a free service which shows you some real numbers about the billing. You also have good reporting, and you can quickly understand where you stand in comparison (for example) with a previous billing period.

➡️ Budget Alerts

Part of the Cost Management service too, this feature is an area where you can set up some budgets with limits.

When a limit is reached, you can be notified about it, so that you can react before the costs start to pile up.

➡️ Tags

It is recommended to use tags for resources to achieve various classification purposes. One advantage of tagging resources is the fact that they make your life easier in cost reporting. This way, you can understand which areas are more expensive and you can focus on them if needed.

➡️ Advisor

It is a service oriented on the 5 pillars mentioned before – therefore, it has a section dedicated to costs. You can get some recommendations about how to reduce your cloud costs directly from Microsoft based on the actual usage.

➡️ Azure Policies

Used for governance, Azure policies can play a key role in preventing overallocation or mistakes. Imagine you are about to create a virtual machine and choose a wrong size. Wouldn’t it be nice to have something to tell you this when creating the VM and not to find out after 1-2 weeks (or when the invoice will be created)? You can set this up using a built-in policy named “Allowed virtual machine size SKUs”.

Additionally, you can enforce good practices using the “Add a tag to resources” built-in policy which can improve your cost analysis.

➡️ Usage and estimated costs

Some services (e.g., Insights) offer a “Usage and estimated costs” pane where you can get detailed information about the usage and related costs. When it is available, look for it – it can offer valuable insights!

Azure Monitor has a similar pane which offers an overview for multiple resources.

Step 3: Cost trade-offs

You need to be aware that cost optimization doesn’t necessarily mean the absolute minimum cost you can obtain will still be able to run your workload in the cloud. In fact, you need to make a lot of balancing between the pillars mentioned at the beginning. This should be the third item on your list and probably the hardest to achieve properly. Let’s take a step back and see the cost optimization in relation to other pillars of the Azure Well-Architected Framework. In other words, how can you make informed decisions?

As a reminder, the five pillars are:

  • Reliability
  • Security
  • Cost Optimization
  • Operation Excellence
  • Performance Efficiency

Let’s take them one by one and shortly balance them against Cost Optimization.

➡️ Cost Optimization vs. Reliability

Terms like SLA (Service Level Agreement), RTO (Recovery Time Objective) or RPO (Recovery Point Objective) may mean something to you. Usually, these come with a cost which needs to be carefully analyzed. For example, if it is critical for your website to remain online even if the region fades away, your spendings will increase. Therefore, costs have a direct correlation with reliability.

➡️ Cost Optimization vs. Security

We want software to be secure and that is mandatory these days. But, depending on the industry, we can be in a position to choose some solutions which come with a mandatory cost. For example, some regulations impose your app service to run on its own separate infrastructure (in isolation) – forcing you to choose the App Service Environment option which is not cheap. There is also a plethora of Azure Services (Azure Firewall, Defender for Cloud etc.) which you might consider, but which come with a need for increased budgets. Again, costs have a direct correlation with security.

➡️ Cost Optimization vs. Operation Excellence

Quick reactions to an incident through enough information based on logs is a must-have. But with active monitoring, you can react even before your customer notices. There is a cost which will come both from the initial investment in monitoring and automation but also directly related to keeping those running optimally. You should carefully balance between the amount of logs you have in Application Insights and their associated costs.

Similarly, decisions such as using IaaS or PaaS resources should take into consideration the hidden costs of maintaining infrastructure, which is not obvious when comparing the options using a tool like Price Calculator.

➡️ Cost Optimization vs. Performance Efficiency

Performance usually comes with a cost since it is natural to just increase the processor/memory to make applications faster, right? Which almost always means increased cloud fees. But here, you should try to benefit from the cloud model. That means:

  • Decide on fixed vs. consumption-based provisioning – consumption-based is better (cost wise) but maybe your application is not really prepared for that. But even in a fixed based provisioning you can benefit from the cloud by using autoscale features whenever available
  • Caching – services like Azure Redis Cache can be considered here with their associated cost

Most probably, you’ll not be able to get the right balance from the start and you’ll need to go through the trade-offs multiple times during a project’s life cycle. In fact, you’ll go through all steps multiple times to perform fine tuning or benefit from the latest additions to the cloud framework since this will evolve constantly.

Cost optimization for fintechs

Cost saving and cost optimization are primordial for fintechs in the current economic climate. Financial companies that can save costs while at the same time not impacting the customer experience are the ones that succeed on the market, with a good offering of price and value.

How does Azure play into this? Fintechs that use Microsoft Azure cloud services need to be wary of their costs, while maintaining the performance and security their company and their users require. Moreso, as a company starts to grow and scale operations, their use of Azure services is likely to grow as well, together with the bill associated with running such an infrastructure.

This is where cost optimization steps in: by managing costs, including the use of Azure Reservations, the implementation of Azure Cost Management and Billing, and the use of Azure DevOps to automate processes and reduce manual labor costs, fintech can stay ahead of the curve. What’s more important, Azure is flexible depending on each company’s needs: my advice for fintech considering Azure is to carefully analyze their platform, and choose the right combination of services and pricing that serves their product best. This way, fintechs can focus on business growth and staying ahead of competition, by avoiding unforeseen costs that can delay innovation plans.

Final thoughts and a story

Overlooking some of these steps can lead to some unpleasant surprises. I saw several times Visual Studio development subscriptions with Azure credits getting suspended due to choosing the wrong tier for an Azure service. But several years ago, I was able to learn all these the hard way. I set up a personal “pay as you go” subscription using the 12-month Azure benefits and I was almost at the end of that grace period when I created an Azure App Service with a separate plan for a personal project. The deployment went fine,I closed my laptop and forgot about it for the next weeks. When I reached the Azure portal again and checked the Cost Management, a big chunk of my credit had disappeared! It turned out that I chose the wrong tier for that app service plan (obviously, I didn’t want that “near-production” tier for my personal project). Luckily, I was saved by my last-minute free credit, and I no funds were deducted from my credit card. Of course, I became a friend of the Azure Calculator and I quickly set up some budget alerts which saved me several times from not paying for my innocent mistakes.

About Sergiu Ibanescu

Sergiu is an Expert Software Developer and a Tech Lead at Maxcode, with over 10 years of experience working with .NET and Azure. In his role, Sergiu is constantly looking for new trends and ideas that can help the products he works on and his team, as well as sharing his knowledge to create and maintain the right mix of technical skills for the project.

 

Share this article