Based on our experience, we have identified several commonly used Azure services that contribute significantly to monthly costs. For each service, I will suggest cost-saving measures that can be easily implemented. However, before implementing these techniques, it is crucial to reevaluate your technical architecture to optimize performance and efficiency. This may involve considering alternative services or architectures, such as serverless computing, containers, or microservices, which can help lower costs. For more detailed information on implementing Financial Optimization (FinOps) in Azure, you can explore this TechCommunity blog.
Once you have optimized your technical architecture, here are a list of common Azure services
and their cost optimization techniques.
- Azure Subscriptions
Azure Dev test subscription is a unique offer for active Visual Studio subscribers who want to use Azure for development and testing purposes. Some of the benefits of this offer are:
- You can get discounted rates for Azure services like virtual machines, app services, and storage
- Multiple subscriptions can be created without any additional cost
- Your own licenses for Microsoft software like Windows Server, SQL Server, and SharePoint Server can be used on Azure VMs
- Exclusive features and tools like Visual Studio Code Spaces and Azure DevTest Labs are available for dev/test scenarios.
Some of the pre-requisites, terms and conditions user should know while using Dev Test subscriptions are:
- You need an active Visual Studio subscription to be eligible for this offer.
- Use your Microsoft account linked to your Visual Studio subscription to create or access your Dev Test subscriptions.
- The resources provided through this offer are for application development and testing purposes only.
- These resources cannot be used for production workloads or any other purpose.
- No uptime guarantees or technical support is included in this offer.
- If you require technical support, you can purchase it separately.
2. Azure VM (virtual machines)
A.Right sizing & shutdowns
- Auto shutdown and startup during off-hours - Azure Automation provides a feature to start or stop Azure Virtual Machines (VMs) during off-hours as per user-defined schedules. This feature is available for both Azure Resource Manager and classic VMs.
- Resize SKU recommendations - Azure Advisor suggests resizing virtual machines or scale sets to a cheaper or more suitable SKU, or fewer instances of the same SKU, based on the retail rates. With the above recommendations and your application usage benchmark, you can resize the VMs for less cost without affecting performance.
- Auto scale Azure resources when possible: Auto scale up and scale down instances as per usage pattern. This helps you achieve cost optimization, where costs scale linearly with demand.
B. Using cost controls
There are different payment options for VMs depending on your workload requirements and budget. Some factors that affect the cost are SLA (service level agreements), region, OS (operating systems), and number of instances.
The payment options are:
- Pay as you go: pay by the second for flexible and unpredictable workloads that need high availability.
- Reserved Virtual Machine Instances: pay in advance for one or three years for steady-state workloads and save money compared to pay as you go.
- Savings plans: commit to a fixed hourly amount across compute services for one or three years and get discounts across regions.
- Spot pricing: pay for unused compute capacity at low prices for interruptible and flexible workloads.
- Dev-Test pricing: As pointed out in point #1, get discounted rates on Azure for development and testing environments that can be created and dropped on demand.
C. Windows VMs - Hybrid benefits
Azure Hybrid Benefit can save costs by using your on-premises Windows Server licenses with Software Assurance for VMs in Azure.
- To get started, check your eligibility and choose a deployment method for your Windows VMs.
- You can deploy images from Azure Marketplace, upload a custom VM, or convert an existing VM.
- Enable Azure Hybrid Benefit on your Windows VMs during or after deployment using Azure portal, PowerShell, CLI (command-line interfaces), or templates.
- Limitations apply, such as limits on the number of virtual machines per license and restrictions on using third-party marketplace images.
For more details, please refer to these documents: Azure Hybrid Benefit guide
3. Databases
There are many types of databases on Azure, such as Azure SQL Database, Azure Cosmos DB, Azure Database for MySQL, Azure Database for PostgreSQL, and Azure Database for MariaDB.
Each database has its own cost optimization methods.
- For Azure SQL Database
- You can use elastic pools to share resources among multiple databases
- Use reserved capacity to prepay for compute resources at a discounted rate
- Like Windows VMs, you can use Hybrid Benefits to save the cost on Azure for SQL DBs
- Use serverless compute tier which bills per second of usage and automatically scale ups and down based on demand
- However, you cannot reserve DTU-based (basic, standard, or premium) databases in SQL Database
- Azure Cosmos DB
- You can use auto scale provisioned throughput to adjust your request units (RUs) based on your workload patterns
- Use reserved capacity to prepay for RUs at a discounted rate
- Use time-to-live (TTL) feature to delete old data automatically
- Use effective partitioning to avoid hot partitions.
- Use caching solutions to reduce requests and RU consumption.
- Optimize development/testing cost by using the local emulator, the Azure Cosmos DB free tier, Azure free account
Refer to the Azure Cosmos DB documentation to see detailed steps to implement cost saving for the above-mentioned techniques.
- Azure Database for MySQL/PostgreSQL/MariaDB,
- You can use flexible server option to choose between burstable or general-purpose compute tiers based on your performance needs
- With Flexible server, use stop/start feature to pause your server when not in use
- Save on compute costs by using reserved capacity to prepay for compute resources at a discounted rate.
- Choose the right server size for your workload.
- Use of Single-Server service supports 99.99% of availability, cutting the cost of passive hot standby due to its cloud native design.
- For workloads with intermittent or unpredictable demand use Serverless mode.
- Azure App services
- Consider cost savings by using the App Service Premium v3 plan over the Premium v2 plan. The App Service Premium (v3) Plan has a 20% discount versus comparable Pv2.
- With Pv3 plan, you can use Reservation if you are expecting stable usage over one to three years.
- Also, with the Pv3 plan, the Savings plan can be used to save money.
- Consider Basic or Free tier for non-production usage.
- If your application has small, isolated workloads, consider using Azure Functions instead of Azure App Services.
- Azure Storage accounts
- Choose the storage tier that meets your requirements which minimizes the cost.
- Use lifecycle management policies to automatically transition data to lower-cost storage tiers or delete it when it's no longer needed.
- Use data compression and deduplication to reduce storage costs and improve data transfer performance.
- Use the soft delete feature to retain deleted data and avoid costly data recovery.
- Azure Storage Disks
- Premium Disks (P30 and minimum 1 TiB onwards) can be reserved (one or three years) at a discounted price.
- Use bursting for P20 and lower disks for workloads, such as batch jobs, workloads, which handle traffic spikes, and to improve OS boot time.
- Use disk snapshots to create point-in-time backups of disks and reduce backup storage costs.
- Use Azure Backup to back up your disks to Azure Storage, which can be more cost-effective.
- Monitor disk usage and optimize it by deleting unused disks or resizing disks.
- AKS (Azure Kubernetes Service)
- AKS (Azure Kubernetes Service) provides various cost optimization options for different environments.
- Use cluster pre-set configuration to choose the right VM SKU, number of nodes, number of availability zones, etc. for different environments while highlighting the impact on cost.
- Set resource requests and limits for your workloads to manage the compute resources within an AKS cluster.
- Use Vertical Pod Autoscaler (currently in preview) to automatically set resource requests and limits on containers per workload, based on past usage.
- Completely turn off your cluster by using cluster start/stop for AKS clusters that do not have to be running all the time.
- AKS offers a free tier for Dev/Test workloads or POC (proof of concept) without charge for control plane, providing a fully managed Kubernetes control plane at no cost.
- Azure Spot virtual machines offer deep discounts (up to 90%) for unutilized capacity in Azure. Add a secondary Spot node pool to the cluster to use Spot VMs in AKS.
- Azure Reserved Virtual Machine subscription allows you to save up to 72% on pay-as-you-go prices for consistent and long-term workloads.
- AKS supports ephemeral OS disks that are free and can replace persistent disks for certain types of workloads to help save costs. However, ephemeral OS disks may not be suitable for all workloads and may not offer the same level of reliability and data durability as persistent disks.
- Using Azure Blob storage and the CSI driver in AKS can help save costs on expensive persistent storage solutions while still meeting your unstructured data storage needs.
You can refer to Azure Well-Architected Framework for more detailed guidance on cost optimization for AKS.
- Azure Log analytics
- Consider using the Commitment Tiers pricing model to the Log Analytics workspace. Commitment Tiers enable saving as much as 30% compared to Pay-As-You-Go pricing but Commitment Tiers start at 100 GB/day.
- Set up data retention policies to delete old data you no longer need and keep data ingestion and storage under control.
- Only ingest the data you need and filter it by source or type to reduce data ingestion and storage costs.
- Instead of ingesting all data, use sampling to ingest a subset of data and reduce costs while still providing useful insights.
- Compress data before ingesting it into Log Analytics to reduce storage costs by up to 50%.
- Use Azure Data Explorer - Storing logs in Azure Data Explorer reduces costs while retaining your ability to query your data and it is especially useful as your data grows.
- Azure Functions
- Use the serverless consumption plan to scale automatically based on incoming requests and pay only for the compute resources utilized.
- Consider Savings plan when using Premium Plan for Functions.
- Reduce execution time and resource usage by optimizing your function code.
- Use caching to reduce requests to external services and improve performance, reducing costs.
- Reduce function executions and unnecessary processing with efficient triggers.
- Azure Monitor
- Use data sampling to reduce data ingestion and storage costs while still providing valuable insights.
- Set up data retention policies to delete old data you no longer need and keep data ingestion and storage under control.
- Optimize queries to reduce data processing costs and improve query performance.
- Use log profiles to selectively ingest logs and metrics based on custom filters to reduce ingestion costs.
- Use alerts judiciously to avoid unnecessary alerts and reduce alerting costs.
- Azure Cognitive Search
- Choose the right service tier that meets your requirements and budget.
- Create resources in the same region to minimize or cut bandwidth charges.
- Optimize search index size by removing unnecessary fields and compressing text data.
- Use Azure Blob Storage to store and index data to save costs.
- Utilize features such as indexer scheduling, query performance optimization, and autoscaling to further optimize costs.
Optimizing your cloud costs is a crucial part of your overall cloud strategy, and the above most used Azure services listed in this blog are commonly used services to focus on when seeking cost savings. By implementing the cost-saving measures we've discussed above, you can reduce your Azure bill while maintaining elevated performance and reliability.