Today’s post will cover Reduce Azure App Service Costs and is part of the Azure Savings series of that cover ways to save money on Azure.
Once I heard, and used ever since this analogy, that using cloud resources is similar to use electricity: the more you use, the more expensive it will be. Although, you can also save money if you apply to the cloud what you currently do for electricity
Turn off things that are not in use!
Other posts from Azure Savings series
Azure Savings Scheduled Shutdown and Startup of Virtual Machines
Before we get started, please allow me to explain the difference between Azure App Service (Web App) and App Service Plans.
Azure App Service (Web App) vs App Service Plans
App Service and App Service Plans are not the same thing, and here is why
- App Service Plan is the compute resources
- App Service is the web server where the configuration and settings sit
So, we can establish the following relation between Web App and App Service Plan can be determined
Where N App Services can use the same App Service Plan, as long as it still has resources to handle it
You can get a detailed explanation about Azure App Service (Web App) and App Service Plans here.
How App Service are billed?
You will be charged by the compute resources you are using, which means, the App Service Plan that determines how much that will cost for you.
Unlike Virtual Machines, App Service Plans are billed per second basis which means from the moment it becomes part of your environment, you are getting charged for it.
Another difference from Virtual Machines is that even if you Stop your App Service, charges still apply because the App Service Plan is running, and you cannot Deallocate it.
Before I explain about to you about saving some money with App Services, let me walk you through the different tiers you can have with App Service Plans.
App Service Plan tiers
Since the App Service Plan regulate how much you will pay, it has different flavors that determines the features you will get in your App Services.
- Shared
As you can imagine, the Shared tier runs an app on the same Azure VM as other App Service apps, including apps of other customers. You have two options to use a Shared tier- Free
- Shared
- Dedicated
If you are looking to have apps in dedicated Azure VMs, this is the option you are looking for. You have the following options to use a Dedicated tier- Basic
- Standard
- Premium
- Premium v2
- Premium v3
- Isolated
Besides run on dedicated Azure VMs, Isolated tier also has their own Azure Virtual Networks
Reduce Azure App Service Costs
As you can imagine the App Service Plan tiers have different prices and, since there’s no way to simple Deallocate to stop charges, so how you can reduce Azure App Service Costs?
You have two options to make it happen: resize the App Service Plan to a lower tier or use the same App Service Plan for multiple App Services
IMPORTANT
Be careful to apply these changes to PRODUCTION environments, because modifying App Service Plans will affect the resources available for your application
Also, the idea behind saving money with these actions, would be a better fit if you have idle applications or test/dev environments that could use less compute resources to deliver the same work.
Resize App Service Plan
In App Services, select your App Service (1), navigate to Scale Up (App Service Plan) (2) and check which Tier your application currently is
Before you proceed by reducing the tier, you should check which Included Features your App Service Plan currently has
I am running P2v2, and these are the included features
- Custom domains / SSL
- Auto scale (up to 20 instances)
- Staging slots
- Daily backups
- Traffic manager
Let’s have a look at B1 and S1
B1 Included Features
B1 has Custom domains / SSL and Manual Scale but no support to Staging Slots, Daily Backups and Traffic Manager
If you have one of the unsupported features in use, you either not able to resize to B1, for example if you are using Backup
Or you lose the ability to use the feature, for example Traffic Manager
App Service using P2v2 accessing through Traffic Manager address
App Service resized to B1 accessing through Traffic Manager address
S1 Included Features
S1 has the same included features as P2v2, however, different limits for each feature, for example S1 allows 10 daily backups when P2v2 allows 50 daily backups
If your App Service is below or at the limit of the included features at S1, then you shouldn’t have issues while resizing it, otherwise you might see errors while trying to perform that
For example, if you have more instances than the supported by S1
Or if you have more Staging slots than the supported by S1
Alright, I am running P2v2 and my application is using the following Included Features
- Custom domains/SSL
- 3 instances (Auto scale)
- 1 Staging Slot
- 1 daily backup
Having the features verified, and its limits, I can now safely resize my App Service Plan to S1 by choosing S1 (1) in the Scale Up (App Service plan), and hit Apply (2)
Wait for the Update to be completed and receive The plan ‘app-service-plan-01’ was updated successfully!
Multiple App Services in a single App Service Plan
The main idea behind multiple App Services in a single App Service Plan is to use a single compute resource and reducing costs whenever it is possible.
IMPORTANT
You can move an app to another App Service plan, as long as the source plan and the target plan are in the same resource group and geographical region.
https://docs.microsoft.com/en-us/azure/app-service/app-service-plan-manage#move-an-app-to-another-app-service-plan
In App Services, select your App Service (1), navigate to Change App Service Plan (2) and hit Ok (3)
Wait for the Update to be completed and receive Changing App Service plan
However, this will happen if the Destination App Service Plan has enough room at the Included Features, otherwise you will have some problems as previously shown
For example, I tried to change the App Service Plan from a P2v2 to a B1, but I have 5 instances (Scale Out), so I received the following message
That said, you also should keep in mind to review the Included Features of the destination App Service Plan to avoid errors during the process.
And that’s it!
I hope you liked it, and I’ll see you on my next post!
Deixe um comentário