Most university programs are very good at teaching students how to make good software. However, distribution of software is rarely discussed, leaving many to learn this by trial and error. In the case of a web applications, this needs to be decided early, as it will shape the choices of technology and development methodology.
The first option to host a web application is to rent out a server and install everything from scratch. This means managing both the operating system and the application software. For a small deployment, this is expensive and a tremendous amount of effort. However, this offers an unequalled level of control, as each piece of software can be custom configured.
With proper configuration automation tools such as Puppet, Ansible or Chef, bare metal can be incredibly cost effective in large deployment. It's not uncommon to see large companies ( Dropbox, 37signals, BackBlaze ) adopt bare metal solutions as they grow. Bare metal solution are available from several providers such as Ovh, Vultr and even AWS.
A virtual machine is the virtualisation of a computer. Hardware is emulated, allowing the installed operating system to function as if running on actual hardware. Virtual machines are hosted on a powerful computer, the hypervisor. They are an efficient way to split its resources across different workload. Popular hypervisor software that can be installed on bare metal hardware include KVM, ESXi and Hyper-V.
When working with cloud platforms, virtual machines are often called compute units. They are available on different cloud providers such as AWS EC2, GCP Compute Engine, Azure VM, OVH Cloud VPS and DO Droplets. Billing is almost always by the hour, making this a cost effective solution that scales linearly with the workload. However, they are easier to use since there is no hardware to maintain. As with with bare metal, Virtual Machines used in large quantities should be manage using configuration management/automation tools.
Containers are the emulation of an operating system. An application operating in a container will execute system calls believing it is communicating with the operating system. In truth, the application is communicating with the container engine, such as Docker or LXC. This lightweight emulation is incredibly efficient and easy to maintain.
Container deployment are event easier to manage when paired with an orchestration system, such as Kubernetes or Rancher. Most cloud platform support some form of container deployment. Popular platforms include AWS ECS, GCP GKE, Azure AKS, DO Kubernetes, OVH Kubernetes and Heroku. Billing is often determined by the number of node in the orchestration system, which can be costly in a deployment with few containers. However, in large deployment, container architecture can be very cost effective.
In a serverless deployment, code is package and deployed directly to a cloud platform. This allows developers to deploy an application without having to worry about managing servers. The code still operates on servers, but they are abstracted away. In essence, serverless promotes ease-of-use by directly deploying functions at the cost of control. This works best when functions are short-lived.
Given their ease of deployment, they are the fastest solution to get an application up and running. In addition, they are inexpensive for a small deployment, as billing is based on execution time. Unfortunately, costs can increases quite quickly, making this solution sometimes unfeasible for large deployment. Serverless solution can be found in AWS Lamba, GCP Cloud Functions, Azure Functions and DO Functions.
The Perfect Choice
These solutions are not distinct, they operate in layers :
- Virtual machines operate on a hypervisor, which is a bare metal server.
- Most container orchestration platform operate on virtual machines.
- Many serverless architecture leverage containers or virtual machines behind the scene (for example fission.io) .
As such, there is a lot of overlap in the different solutions and no correct answer.
A new startup will most likely need to deploy code as fast a possible, with as little cost as possible. Serverless will most likely be the ideal choice for this type of prototyping. If the prototype is successful, containers are the next logical choice in terms of effort and costs. Most companies can continue using containers for a long time, as they are especially popular in micro-service architectures. Bare-metal deployment should be reserved only for large scale deployment, when supported by the appropriate staff. That said, virtual machine remain the gold standard for specialised or legacy application.
Several cloud platforms offer trial credits to experiment. Student can explore many of these solutions using the GitHub Student Developer Pack. In addition to providing many development tools, you can get more credits for several cloud platform.
All these platform deployment strategies work, so there is no perfect choice. However, investing time in finding what platform best suit your use case will save you time and money in the long run.