Introduction

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 $$$.

Normal Architecture

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.

3_1RG

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.

Azure App Service in different Resource Groups
Azure App Services in different Resource Groups

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

  1. Each App Service (Web App) is hosted in an App Service Plan.
  2. 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.

Share Azure App Plan across Resource Groups
Share Azure App Plan across Resource Groups

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.

Share Azure App Plan across 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.

App Service in Resource Group1
App Service in Resource Group1

Similarly, when you create another App Service in ResourceGroup2, you can still see the shared App Service Plan as shown below.

App Service in Resource Group2
App Service in Resource Group2

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.

Advertisements