Updated for 2021!
Including low-budget options
There are several options for hosting your Python app, including Flask and Django web apps, microservices and telegram bots. In this post, I will give a short overview of available options to deploy and host Python application for free or for less than 6$ per month. In the second part, I will show step by step deployment to one of the platforms.
Hosting options fall into two main categories: you either self-host or use external services to host your application.
Each of them in their turn has a handful of options, which I will outline here with pricing and other relevant information as of 2020.
VPS (Virtual Private Server) is a virtual machine hosted on a physical server. It is a server that hosts multiple virtual servers each isolated from the others. It also referred to as a bare-metal server and can also be described as a sort of hardware sharing. With VPS, you are sharing a server with multiple users, but you have dedicated private resources. Such as you have root access and control over data, RAM, bandwidth and server space, as well as hardware and software configurations. VPS solutions are secure, stable, and inexpensive and require lower technical knowledge compared to support of dedicated server as in most cases it features GUI panels and dashboards.
The primary disadvantage of virtualised servers is that there is resource overhead in the virtualisation process. Besides, physical constraints such as large Input/Output operations by a single virtualised instance on persistent storage can cause performance bottlenecks for other VPS on the shared server.
Things to consider while choosing VPS:
-Environment (Linux/Windows),
-Managed-Unmanaged,
-Redundancy and scalability (think backup, bandwidth and scaling-up),
-Customer support quality.
VPS |
||||||
Provider | CPU | Memory | Storage SSD | Bandwidth | Price/month | Additional info |
---|---|---|---|---|---|---|
Digital Ocean | 1 vCPU | 1GB | 25GB | 1TB | 5 USD | |
Linode | 1 vCPU | 1GB | 25GB | 1TB | 5 USD | Network: in 40Gbps, out 1000Mbps |
RamNode | 1 vCPU | 512MB | 15GB | 1000GB | 3 USD | |
Scaleway | 2 vCPU | 2GB | 20GB | 20 Mbps | 4.99 EUR | |
Netcup | 1 vCPU | 1GB | 20GB | 40TB | 2.62 EUR | |
Quadhost | 2 vCPU | 512 Mb | 20GB | 750GB | 4.62 USD | |
OVH | 1 vCPU | 2GB | 40GB | 1TB | 6 USD | |
Uberspace | no fixed computing power | – | 10GB | – | 5 EUR | First month free; Data centers run exclusively on renewable energy; No contract, cancel anytime; Trial with email only |
Cloud server is similar to VPS and resembles a type of distributed hosting. Instead of partitioning one server into several virtual machines, it combines several computers into one powerful server. So user requests can be spread among many different computers. This method helps to eliminate downtime and ensures there is always another server ready to pick up the slack if things get busy or there’s a problem.
Pricing policy for cloud services is a bit different compared to VPS. For some reason, the major players on the market have made it the least clear of what you will get and how much you will pay. Most of the time, there are some free limited options for deploying and hosting. Once you have exhausted the limit, you will be automatically charged the hourly rates without any options. But trying to figure out the rates is like filling your Tax return for the first time using the ATO website. There are lots of granular options, hyperlinks that supposed to clarify the matter but instead make the things more confusing. It is not intuitive. Or maybe it is just me not passing the smart gate.
Cloud |
||||||
Provider | CPU | Memory | Storage SSD | Bandwidth | Price/month | Additional info |
---|---|---|---|---|---|---|
Oracle cloud | 1/8 OCPU x 2 | 1GB x 2 | 120GB | 10TB | Free | 10 Mbps bandwidth; 2 Autonomous Databases each with 1 OCPU and 20 GB storage. |
Amazon Web Services | – | – | 30GB block volume | – | Free 12 month | 12 month free; Always free tier for eligible customers; short-term free trial offers. |
Microsoft Azure | – | – | 64GB x 2 | 15GB | Free 12 month | 25 of Always Free products for eligible customers; 250GB SQL Database; Azure Cosmos DB; VMs and more |
Google Cloud | – | – | – | – | Free 3 month (= $300 credit) | 20+ Always free (with usage limit) services available for eligible customers. You will need to provide valid billing details to set up account |
Google Cloud functions | 200,000 GHz-seconds of compute time | Memory | 400,000 GB-seconds | 5GB, 20 Mbps | Free with limitations | First 2 million invocations are free, Deployment costs (about $0.026USD per GB), valid billing details to set up account. |
Heroku | – | 512 Mb | Free | Heroku runs your app in lightweight, isolated Linux containers called “dynos.” The platform offers different dyno types to help you get the best results for your type of app. Deploy with Git and Docker. | ||
OpenShift | 2GiB* | 2GiB | – | – | Free | 1 project with limitations |
PythonAnywhere | 2000 CPU-seconds | 512MB | 1 Gb | – | 5$/month Free limited account |
Ipython/Jupiter notebooks suport; one web app per free account. |
Self-hosting
Another option is to self-host on your own server. This choice offers the most control and usually has the highest performance for the price, but also is the most expensive upfront option and has the highest ongoing maintenance (think support, electricity bills).
With the self-hosted option, you have full control over your website, app or software. You are also free to use all your server’s resources, which can have both upsides and downsides (if your server has limited capacity). Another possible downside is that a self-hosted alternative requires experience with servers, while hosted options are more straightforward for beginners.
Here we have:
Stand alone servers including boards (Banana Pi, Raspberry Pi)
Tunnels.
Some free options for tunnels:
- ngrok has a limited free plan and low cost option for 60USD/year,
- localtunnel – an open-source project (requires Node.js),
- localhost.run requires no download, uses SSH,
- telebit allows port forwarding, file sharing, can be configured like a VPN
* GiB = Gibibyte
1GB = 1e+9 bytes
1GiB = 1.074e+9 bytes
1GiB>1GB