So we have established in my last post that we are building a Cloud Serverless Architecture in Azure that is Secure, Scalable and Highly Available – so how do we do that?
First things first, do we have a budget? If we do, that can quickly scale back those crazy ambitions when we realise how much it costs to run. Even if we don’t it’s worth considering – how much can we afford to send a month? Ultimately, this is your first consideration as without an idea of how much to spend (relative to how much you’re making) you could be in trouble very early on.
So, let’s think about what we need. We need a UI for the user to interact with, some APIs and a database. In a nutshell, that is our core architecture.
Now, how much would this cost? We can use the Azure Pricing Calculator to get an idea. Two things to know, first is make sure you have the right currency as well as that you are selecting the right region for your resources to be deployed in. Usually, the standard choice for region is simply the nearest one to you as this reduces latency (no point you using American servers if you’re in the UK). Then use the Search bar to click the things you want to use to add them to a basket at the bottom of the page. Once you’re done, scroll down and configure the settings to your usage to see the cost.
For this setup, we only actually have three components in Azure, some Function Apps, a Web App and a CosmosDb.
Our CosmosDb instance we will set to Single Region Provisioned Throughput (Manual) at 400RUs at £17.41 per month.
Our Function Apps are set to Consumption plan and we get a lovely note stating ‘The first 400,000 GB/s of execution and 1,000,000 executions are free.’ As a start up, this is certainly a cost effective beginning. As an indication though, a heavy handed check on the calculator, 10,000,000 requests taking a second to execute and a 512 memory size would cost £56.20. When we are dealing with consumption based, this level of understanding (number of requests, memory consumption and execution time) is very important. There is a natural tipping point, when it is cheaper to provision dedicated resource via an App Service Plan, so we will keep an eye out for this.
Finally, out Web App on Basic (which is only for early stage Start Ups, normally I would scale up to Standard plan once traffic volumes are established), costs about £51.14 per month. As a note, this plan can also host function apps, so if we needed rich that tipping point, we could host them here as well (if cpu density allows).
Let’s take it a little further though. We are going to have 3 UIs based on our User Personas of ‘Web Customer’, ‘Web Company’, ‘App Customer’ and ‘Web Admin’. We might have web backends for them, depending on how we do authentication for our users so we can include a provisional resource for that as well for the moment. This begs a bigger question about our design though, although we can make our UI talk directly to the function apps – should we? Azure has the ability to add in API Management, which can deal with our API security by talking an external identity provider as well as routing requests to other services as we need. We also want to add in some logging through Azure Monitor/ Application Insights. Lets add these to the view (as seen below).
That looks good! It’s a basic set up, but one that we can easily extend later when our start up grows. It’s important to note that right now, this is our target architecture based on our current requirements. Our baseline is currently a blank piece of paper because we have nothing! When we start building, I will do a post on covering the baseline, transition and target state architectures and how to manage this as it grows.