One of the responsibilities of Architect is to Save costs to the customer as much as possible. In this article, we will learn a simple technique to save some $$$.
When you work on Azure Platform as a Service, you would deploy your Web Application into Azure App Service inside an App Service Plan. Both of these (App Service and the App Service Plan) would reside in a Resource Group which would look something like shown below.
When the application grows, you would have multiple modules. One of the possible ways of organizing the azure services is to group them into multiple Resource Groups based on their Domain functionality. Below is the very basic application architecture of a project with two or more modules in a large application.
Note: If you are working in a large project, you could segregate the components into multiple resource groups based on their domain.
In the above reference architecture
- Each App Service (Web App) is hosted in an App Service Plan.
- The App Service and the App Service Plan reside in a separate Resource Group.
Cost Effective Architecture
In the Normal Architecture, you (your customer) would end up paying $$ depending on how many App Service Plans you are using and the size of the App Service Plan. Sometimes, you might not want isolation of individual apps in separate App Service Plans. Your priority would be reducing the cost as much as possible.
Did you ever wonder if it’s possible to share the App Service Plan across different Resource Groups?
Yes, it is possible, An App Service Plan can be used to host App Services from different Resource Groups which looks something like shown below.
In the above diagram, the Web Apps from two Resource Groups are referring to an App Service Plan which is located in altogether another Resource Group.
How to do it?
Create the following Resource Groups.
And, as shown in the below image, while creating the first App Service in ResourceGroup1 you can choose the App Service Plan which is located in another Resource Group.
Similarly, when you create another App Service in ResourceGroup2, you can still see the shared App Service Plan as shown below.
Points to Note:
- App Services and the corresponding App Service Plan need not reside in the same Resource Group. They can be in two different Resource Groups.
- The App Services of two different Domains (Sub-Projects) can reside in a Single shared (across Resource Group) App Service Plan to reduce the cost.
You can learn more above scaling of Azure App Service at Azure Scale up and Scale Out
Hope it helps in optimizing the cost at least in non-production environment.
Do you like this article? If you want to get more updates about these kind of articles, you can join my Learning Groups
That sounds good, thanks for explaining. What are potential downsides / issues when we have Web Apps and App Service Plan in different Resource Groups? Anything negative to consider?
Thank you so much for making this! It was very easy to follow.