When I am teaching about the cloud and especially when I am showing cost optimization, I am presenting an example of Troy Hunt Have I Been Pwned cost saving case. Troy by using Cloudflare as a caching solution and moving traffic outside of Azure, managed to reduce the cost of infrastructure below 1 USD per month. At the end of 2018, when he was describing this case, his page was supporting 141M monthly queries of 517M records. This is a brilliant example of how you should work with your cloud solutions.
Looking at the latest news from Troy- How I Got Pwned by My Cloud Costs – it seems that he forgot to set up the alerting and got an unexpected bill for cloud usage. It cost him about 7k EUR.
I do not want to go into the details of this situation. Please check out the Troy page for details.
Solution – Use the alerts!
The most important lesson from it is to use Azure Alerts. This is a very simple mechanism that you can configure in a few seconds. You have multiple options of alerting that are specific for each service.
At the service level, you just need to select the correct signal, define the time period and threshold value. This is probably one of the fastest ways to realize that something is happening to your infrastructure.
Together with that, I recommend setting up Cost alerts at the Subscription level. To do that, first, you need to define your budget:
And then define your alert conditions:
Both mechanisms will let you know when something is happening with your service.
One thing that you should know. When you are working with Cost alerts, you should be aware of possible delays. Cost and usage data are not real-time data. They are available within 8-24 hours. And then budgets are evaluated against these costs every 24 hours. For a lot of you, it is good enough. If not, you need to use alerting related to services.