Cost Optimisation in Azure
As we go through the current situation with coronavirus many companies will need to review their spending. I have gathered some key resources and tips to start making real differences to your Azure costs today!
This is by no means an exhaustive list and I will add to this as I remember stuff over the coming days but I wanted to share this now so you can start to help your business save money as soon as possible.
MonitoringThis may seem an odd way to start a cost saving exercise but the key to knowing what actions to take is having information available to you so you can make informed decisions. These metrics can give you great insights into your environments and applications and help you identify underutilised resources.
All resources come with some key metrics available to you out of the box without enabling or setting up other resources. Simply browse to the resource in the portal and you will see the metrics on the overview page or can go into the metrics section of the resources.
Azure monitor covers a range of tools to collect telemetry from your resources.
Log Analytics can be used to collect a wide range of telemetry from resources and allow you to create custom queries and get greater insight into your resource usage.
Application Insights provides insight into your application usage and can help you identify trends and troubleshoot issues quickly.
AutoscaleAzure Monitor Autoscale applies only to Virtual Machine Scale Sets, Cloud Services, App Service - Web Apps, and API Management services. If you are using any of these services consider using the Autoscale feature to monitor the performance of your apps and scale up or down. This can scale to meet additional load but equally can be used to scale down your resources to save money when your applications are not as busy.
You can scale on a schedule, so maybe overnight when your resources are less busy. You can also scale depending on metrics for example, you could scale down if CPU is below 30% for ten minutes, you then set the number of instances you wish to scale by when this threshold is hit. You can set your minimum and maximum number of instances. This is a great way to automate the scaling of resources to help save money.
Monitor your spendingYou can use Azure Cost Management to keep an eye on your spending in Azure and AWS. You can filter your spend by subscription, resource group, resource type etc. This is where tagging resources is a big benefit. If you add tags to resources for example for cost-centre, projects, teams etc you can be more granular with your filters to view your spending by these tags, this will help identify trends and identify areas where you may be able to save money.
Right size and remove unused resourcesUnder Cost Management in Azure you will find Advisor Recommendations. This will help identify idle and underutilised resources allowing you to remove or scale down resources to save money.
The recommendations also include other information to help you make cost savings like using reserved instances I provide a real example of the savings that can be made in the section on predict your spending.
Set BudgetsIn cost management you can set budgets for subscription or resources groups and receive alerts if these trend in a way that would exceed your budget for a given period. This allows you to react to this and take action to get spending back on track.
Automate the stop/start of Virtual MachinesUsing an Azure Automation account you can create your own scripts or use runbooks from the market place that can stop/start your VMs. For example, you can use this to ensure dev/test machines are only online Monday to Friday. When VMs are in a deallocated state you do not pay for the compute resources, only for the disks. Turning off machines when you do not need them can help you realise significant savings.
Predict your spendingBefore you deploy new solutions/resources make use of the Azure Cost Calculator to get a good understanding of what the cost of running these resources will be. The calculator provides options to see the cost saving if reserved instances are used, also if you already have license agreements from Microsoft make use of the hybrid agreements.
As an example of saving that can be made on a Virtual Machine (price correct at time of writing);
Virtual Machine SKU D2 v3 2vCPU 8 GB RAM - UK South
1 x VM running for 730 hours would cost
£113.7 per month
Using a 3 year reserved instance saves 32%
£77.16 per month
Using hyrbid Licensing and 3 year reserved instance saves over 75%
£27.10 per month
Restrict the use of expensive SKUsTo control spending you can use Azure Policy to restrict the deployment of certain SKUs on resources to ensure staff can not deploy expensive SKUs that could allow spending to get out of control.
Use the right resource typesReview whether you can you save money by changing the resource type you are using to deliver your services. For example, can a webapp be used instead of a VM for hosting your site. Can you use Azure Functions instead of running these scripts on VMs.
Enterprise Customer SavingEnterprise Agreement customers can realise saving by running dev/test resources in an Azure Enterprise Dev/Test subscription, for full details of the benefits click here.
If you take action on some of these points you can start to realise cost savings now.
I hope this helps!