Skip to Content

Industry best practices to reduce Azure consumption cost

Nitin Mulchandani
June 04, 2020

When migrating workloads to the cloud, every customer in their back of mind is concerned about the cost, which he must deal with in the near future. As an organization/Architect, it becomes necessary to optimize the cost by selecting the right services, right tools, and correct Architecture, etc.

However, optimizing cost is not a onetime approach it is a continuous effort, as Azure keeps updating existing service or new services are introduced at regular intervals.

We will look into some of the known areas where we can optimize the cost:

  • Subscription
  • Region
  • Storage
  • Virtual Machines
  • Network
  • App Service

Subscription

Azure comes with many types of subscription, selecting the right kind of subscription based on your needs can save cost

  • Free: Here we get 200$ credit, 12 months of popular free services and 25+ Always free services
  • MSDN: This subscription is available through MSDN, here user gets monthly prepaid credit which is ideally used for learning and R&D, which can save cost on client’s subscription
  • Enterprise Agreement (EA) / Cloud Solution Provider (CSP): EA and CSP options are for companies that have long term requirements, bulk requirements, and need licenses for multiple users. These kinds of subscription offer built-in cost savings features as billing charges are less than regular Azure subscription (Pay-as-you-go model)
  • Pay-as-you-go: This is a metered billing subscription (monthly cost), here cost is applicable directly once the workload is provisioned.

Region

Before jumping directly into different Azure services. it is important to select the right Azure Datacenter region where resources will be hosted, as pricing varies with region to region and along with pricing it is also important to know the latency.

There are a couple of sites i.e. https://www.azurespeed.com/Azure/Latency  and http://azurespeedtest.azurewebsites.net/which will select our current IP address and will measure latency to different Azure regions and can help us to identify the correct region

Storage

Since storage is the backbone of any cloud service, it is not only important to select the right storage features when hosting workloads on the cloud

  • Select the right Replication & Redundancy options: When creating a storage account there are options to replicate the data, there are options like LRS, ZRS, GRS, and RA-GRS that can give us high availability, but it also comes with a cost. So, select according to the requirement.
  • Azure Blob storage has different access tiers
    • Hot – Used for regular access but has the highest storage cost and lowest access cost
    • Cool – Lower storage costs, higher access costs and used for less frequent access
    • Archive – Lowest storage cost and has the highest access cost
  • Azure blob storage lifecycle management: Azure provides inbuilt lifecycle management for blobs to save cost,  you can either apply different access tiers to your blob manually or you can do it via configuration, which can move your blob to different access tiers based on last modification date or it can even delete it for us.

Below is the representation of blob storage lifecycle management:

Virtual Machines

There are various ways to save cost on Virtual machines

  • Size: Select the right size, Azure virtual machine comes in different types, each type is suited for different workloads. Each Virtual Machine type differs in CPU, Ram, etc.
  • Dev Test Labs: Use this feature when you need to use Virtual Machines for your Developers or Test engineers, as this VM has features like auto start/shutdown features where you can save compute cost when not in use.
  • Spot instances: Workloads that can be interrupted can be used on spot instances, here savings can go up to 90% as compared to regular Pay-as-you-go option.
  • Reserved Instances: Workloads that are required for long term commitments like for 1 year, 2 years, etc., can opt for reserved instances which can significantly reduce cost (up to 72 percent) as compared to a regular pay-as-you-go option.
  • Virtual Machine scale sets: Workloads which need processing for large jobs or needs scalability or when there is a demand to increase or decrease infrastructure based on load, then this is an ideal option
  • Low priority Virtual Machine scale sets: When there is a need for processing large jobs, or proof of concepts, dev/test environments, demos, and when there is no need for SLA. Then this option provides additional cost savings

Network

It is known that going into Azure data centers is free and data leaving the data centers is charged, but there are some other facts when it comes to handling inbound and outbound scenarios:

Azure also has concepts of Networking Zones. There are four zones:

  • Zone 1: US, US Gov, Canada, Europe, UK, France, and Switzerland
  • Zone 2: Asia, Australia, India, Japan, and Korea
  • Zone 3: Brazil, South Africa, and UAE
  • DE Zone 1: Germany

DE Zone 1 has the lowest egress charges and Zone 1 is the cheapest public zone.

Whereas Zone 2 and 3 each are more expensive respectively than other zones. So, for e.g., if we have vNet peering between the US in Zone 1 and Asia in Zone 2, so traffic leaving from US vNet is charged according to Zone 1 rates and traffic entering Asia vNet is charged as per Zone 2 rates and vice versa

So, knowing these concepts will help us how to optimize cost while designing networks in Azure

App Service

App service is designed to run Web, API, and mobile applications. There are ways to optimize cost:

  • Select the right plan
    • Free & Shared: When starting with the initial development of the project or doing some investigation it is recommended to use this plan. This hosting is on a shared server and when high availability of the application is not a concern
    • Dedicated: Includes basic, standard, premium & premium V2. All these plans are covered under SLA from Microsoft. Apart from basic, all are scalable and can be used for production workloads, so more the up you move from Standard to Premium, more the amount you pay. Whereas Basic is used for non-production work loads
    • Isolated: This plan uses dedicated VMs in an isolated VNet. This plan offers the highest scalability and security. But comes with the highest cost as compared with other plans
    • Serverless: In this plan, you pay for what you run; all the other App service plans are charged based on every second. So serverless (Azure functions) are ideal for event-based usage. For e.g. background jobs that are dependent on a timer, http-based events triggered based events, etc. But you also pay for storage account which is associated with this plan which is used to collect logs. Azure also offers a number of free executions per month in the consumption plan
  • Auto Scaling: Scale the application on the basis of CPU usage, schedule scaling to save cost.
  • Slots: Creating slots and hosting multiple applications for different environments under the same plan, can save additional cost

Other Options

  • Cost analysis: Azure has its own cost management portal, where users can see the current cost as well as see the forecast of its subscription in reports. Users can create a budget and set alerts.
  • Snapshot: When using a managed disk as an option in a Virtual machine, incremental snapshots are a cost-effective point-in-time backup of managed disks. Here billing is charged on delta changes to disk since the last snapshot and same are stored on cost-effective storage.

These were few options to keep the cost in check and selecting the services wisely.

References:

https://app.pluralsight.com/library/courses/microsoft-azure-consumption-strategy-optimizing/table-of-contents
https://app.pluralsight.com/library/courses/microsoft-azure-one-time-costs-estimating-recurring-update/table-of-contents
https://docs.microsoft.com/en-us/azure/storage/blobs/storage-lifecycle-management-concepts?tabs=azure-portal

About the author

Manager | India
Nitin Mulchandani is part of Sogeti, OneDeliver team working as an Architect for native app development. He is an Azure certified Architect. With 11+ years of experience in solution delivery, he has delivered multiple engagements for cloud native development for multiple clients across the USA and Europe.

    Comments

    2 thoughts on “Industry best practices to reduce Azure consumption cost

    Leave a Reply

    Your email address will not be published. Required fields are marked *