Want to minimize your Azure ASP.NET Core web app cost? How would 9 euros per month sound? Can do, if you don’t need fancy PaaS features, and host the app on a virtual machine.
Price for production grade App Service starts roughly from 60 euros per month. (Including B1 App Service, SSL cert & Azure DNS). There are scenarios however where this feels a bit too much. An example is a relatively low traffic, non-critical web app which uses an SSL certificate. You really don’t care about auto scaling, deployment slots or other PaaS features. You would still like the application to be always on for the users. What could you do to minimize the cost?
The answer is to host your web app on a virtual machine on Azure. You don’t get the niceties the PaaS services have, and you do need to do some hard manual labor to get the circus running. But in the optimal case you get the Azure ASP.NET Core Web App running costs down to 9 euros per month.
Host and deploy ASP.NET Core
You create a virtual machine, configure a suitable runtime environment, deploy and run your application. A little comparison what it means to host the app by yourself:
The good news
- Very attractive price. Starting from 9 euros per month (using B1S CentOS virtual machine)
- App is always on.
- Use free Certbot certificates, and set up automatic certificate renewal.
- Access to VM filesystem & operating system services, if you happen to need these.
- Accidental bonus: As the web app is now running on vnet, you can create apps that are visible only inside your organization network if you like.
Not so nice…
- You are responsible for whole the VM (deploy, install, protect, auto updates etc.)
- No auto scaling (unless you build a mechanism by yourself)
- No easy auth option for the app. You have to implement this in your code.
- No deployment slots, or easy A/B switching between app versions.
- No Azure managed certificates & their automatic renewals.
- You can have SLA for virtual machine, not the application
- Initial setup and maintenance takes more time & requires somewhat wider skill set.
- PaaS WebApp can be set up in minutes, this takes takes a few days to get up and running.
- Nobody really wants to maintain virtual machines: It’s just not fun, nor productive.
Ok, show me how!
Read the full instructions on Microsoft documentation here. First decide on which kind of virtual machine environment you want to host your application. Hosting dotnet core apps on Linux is a bit cheaper (no Windows licence costs), and yes – it works. Basically your options are (and you have instructions on how) to either use:
- Windows
- Linux
You prepare the application deployment according to the instructions (publish to a folder), create and configure your virtual machine to run the application using the instructions above, copy the publish folder to the machine and – start your engines!
Want to see an example of such deployment in production? Visit Retrocket!
Leave A Comment