Modern Hosting Options - A Quick Overview
Tags: azure, aws, serverless
Published: 2020-01-01 14:07:20

# Hosting Options 

There are a lot of different options for hosting, and it can be quite confusing trying to understand what they all are. This article will make a distinction between services, and providers. Primarily it’s about the services themselves, the actual functionality that can be offered. The better-known providers are described to clarify their role in the industry. 

The offerings described here are taken from most to least capability. The initial options are very generic “compute” services, which means they can execute any code. This comes at a price, more specialised hosting options, dedicated to specific needs, are often easier to use, faster to set up, and significantly cheaper. 

This is not a comprehensive list of hosting options. It’s limited to cloud hosting options, rather than shared VPS or dedicated hosting. It’s also not intended to cover all other hosted services, such as domain registry, DNS, caching or databases. 

## Compute Instances 

A compute instance is a standard cloud “computer” host. It is not dedicated to any one language, or technology, but a general platform capable of executing any code or hosting any technology, such as blockchain nodes, databases, etc. 

Compute instances are the typical platform of choice for a server-side web application, such as PHP, NodeJS, .NET or whatever application solution. 

Compute instances are provisioned essentially as a generic “computer” of a selected level of performance - RAM requirements, drive, operating system, CPU speed, etc - and then left as a blank slate. It is up to the provisioner to log into the new system and add, install, setup and configure all required software. The provider typically does not facilitate this process in any way beyond the provisioning. 

To use an analogy, imagine you were planning to open a factory, or a shop. A compute instance is like buying a block of land. It has no power, no water access, no building on it. It’s a space and nothing more, the rest is up to you. Sometimes that is fine. 

A compute instance can be used to host anything from hosting webpages, displaying image files to mining cryptocurrencies, making it the baseline option for hosting, but one that can be improved on for many needs. 

Common providers of this service include AWS, Microsoft Azure, and Digital Ocean. 

## Platform-as-a-Service 

Platform As A Service options are much like compute instances, but the solutions they create are dedicated to specific technologies or languages. This means they’re pre-configured and optimised to serve these kinds of sites. They often have workflows to rapidly setup and deploy websites. They are typically significantly easier to use and work on than standard compute instances. 

Many PaaS solutions are an abstraction built on top of other cloud providers like AWS. In principle they are more expensive, but in practise they often have attractive free tiers, and can trivialise setup of small or simple web hosts. Larger and/or more complex sites may quickly get prohibitively expensive, however.  

Continuing with the shop or factory analogy as above, a PaaS offering is much more like purchasing a warehouse, or an empty store. It already has fittings, fixtures, power, water, and so on. It will often of course have this at a cost, but a reasonable one considering the alternative. 

The best-known providers started as Ruby platforms, but now offer a wide range of languages. These providers include Heroku, EngineYard and Google App Engine. 

## Block Hosting 

Block hosting is explicitly file hosting. It is designed to simply serve the requested file, not execute any code. This sort of file storage can be used to serve images and other assets, to store logs, documents, as temporary holders for large files to be batch processed and just about everything else. 

Because block hosting needs no processing at all, and hard drive space is extremely cheap, block hosting is consequently very cheap. 

Block hosts are mature offerings now, providing rich features such as high availability, geographical redundancy, CDN caching, ease of programmability, and detailed access controls. 

The dominant player in this space is S3 from AWS, but there is a Microsoft Azure alternative, and Digital Ocean now offers a solution called Spaces.

## Static Hosting 

Static Hosting is primarily designed for websites with static content. This means content where the server doesn’t generate the content, merely serves it up. The most common examples are applications written in JavaScript. The application is sent to the user, and then it’s the user’s browser that does the code execution. 

Because the server doesn’t have to execute any code and has no computational power requirements, static hosting is an extremely low-cost option for any application that can make use of it. In many cases it is completely free, in others it can be a slim fraction of the cost of hosting on something like an EC2 compute instance or Digital Ocean droplet. 

It may seem that the description of static hosting is largely the same as that of block hosting. In fact, there is some cross-over. Block hosts such as S3 can be used as a cheap static host. However, more dedicated static hosting solutions such as Netlify provide impressive ease-of-use and developer ergonomics. They are especially good at setting up things like domain name and SSL certificates rapidly and with little or no friction. 

The strongest player in this space is Netlify, but there are alternatives, including Firebase, Cloudflare, Github Pages, and Surge.sh, that offer similar features. 

## Serverless Hosting 

The serverless approach is the newest option for cloud hosting, and possibly the hardest to explain. Essentially, rather than treating the application as a single “blob” of application, the features and functionality of the system are broken into individual components which are then hosted and executed independently. 

These components or functions are only computed when they’re actually requested, so they have no cost at all when they’re not operating, and an extremely low per-execution cost when they are. 

On larger systems that fit within the ideal use-case this can mean a saving of around 90% on compute hosting, the most expensive type. 

There are downsides, though. An existing web application can’t be simply dumped onto a serverless architecture and be expected to work. It needs to be either built or modified to run like this. Additionally, though the costs are typically cheaper, the actual cost can be hard to calculate in advance. It is possible for the cost to be many times higher in systems that have constant heavy load. A final issue is that the workflows around local development and deployment are not yet mature or well thought-out.  

Not unusually for cloud computing innovations this movement was popularised by Amazon AWS, and their Lambda service is the strongest player.  Microsoft Azure, Cloudflare, and Google Cloud also have options. 

# Combinations are totally acceptable 

The above list may suggest a one-size-fits-all approach, or some sort of optimal solution. Really it will depend greatly on the project and the team involved.  

Most real-world applications don’t just have to host one thing, they have numerous different and unrelated hosting requirements. For example, a Single Page App at minimum needs a backend and a frontend. The frontend is a static site, so a static host is appropriate. The backend is typically an API hosted on something like a compute server. So a Netlify hosted frontend connected to a Digital Ocean backend, that saves files to S3 would be entirely reasonable. 

It should be added that while costs can vary greatly, it’s important not to over-optimise for this, especially early on. A 90% cost saving is significant on a $1000 a month project, but saving that percentage on a $10 Digital Ocean droplet is not going to provide any real return. Particularly when you factor in developer costs. 

There are also nice synergies within some of the more popular services. For example, Netlify has systems that allow a direct connection between a hosted frontend and an AWS Lambda serverless backend. 

# Services and Providers: Not all Equals 

The following table lists services and some of the more common providers that offer them. It’s not intended to be exhaustive or complete, and some of it is subject to definitions. 

Just because two services offer what are ostensibly the same features does not mean they are necessarily equals. While many of these providers technically offer equivalent services, they are only equivalent in broad functionality, not ease of use. 

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/vc5cuda130y8qfarlver.png)

Already mentioned here is that something like AWS S3 Block Storage can be used as a static host, but the process of setting this up, especially setting up SSL and a custom domain, is orders of magnitude harder. When last I tried, Azure had a beta solution for hosting a static site on its Blob Storage, but you couldn’t use a domain or SSL at all. 

Similarly, AWS provides a service called Elastic Beanstalk, which it describes as a Platform as a Service, and is essentially several AWS services configured together for a given technology. In theory this is identical to a dedicated PaaS like Heroku. However, in practise I’ve found it no less challenging than manually configuring services, and with its own share of bugs and issues. 

This isn’t to recommend any one solution, but merely to point out that ergonomics can make or break a solution. The checkmarks in this table do not represent a recommendation, nor imply an equivalence of price, features or ease. Inevitably the service providers for more dedicated services, such as Heroku, Digital Ocean, and Netlify, have more focused and manageable systems and interfaces.