Opscraft
DevOps from zero · Lesson 3 of 6 · 4 min read

Servers, virtual machines, containers and the cloud

What a server is

A server is just a computer whose job is to serve requests from other computers, all day, every day. It usually has no screen or keyboard; you reach it over the network. Almost all servers run Linux. A laptop can act as a server; in a company, servers live in data centres or the cloud.

Virtual machines

A physical server is often much more powerful than one application needs. A hypervisor is software that splits one physical machine into several virtual machines (VMs). Each VM believes it is a complete computer with its own operating system, CPU, memory and disk. An AWS EC2 instance is a virtual machine.

Containers

A container packages an application together with everything it needs — libraries, runtime, configuration — into one image. Containers on the same machine share the host's Linux kernel instead of each running a full operating system, so they start in seconds and use far less memory than VMs. Docker made containers popular; Kubernetes runs many containers across many machines.

Enlarge diagramAppOperating systemHardwareApp AApp BGuest OSGuest OSHypervisorHardwareApp AApp BApp CContainer runtimeHost OS: one kernelHardwarePhysical serverVirtual machinesContainersmostly idle; weeks to buyfull OS each: GBs, minutes to bootshared kernel: MBs, seconds to start
Figure 1. One app per physical server wastes hardware. Virtual machines each carry a full operating system. Containers share one kernel, so they are small and start in seconds.
Swipe sideways to see all of it, or tap to open it full screen.

The big win: the same image runs identically on a developer's laptop, in testing and in production, which ends most "it works on my machine" problems.

The cloud

"The cloud" means renting computing from a provider such as AWS, Azure or Google Cloud instead of buying hardware. You create a server in a minute, pay by the second or hour, and delete it when you are done. Providers also offer managed services — a database, a queue, a Kubernetes control plane — where they handle patching, backups and failover for you.

Cloud services come in three broad levels, depending on how much the provider manages:

Enlarge diagramOn-premisesyour data centreIaaSe.g. EC2PaaSe.g. App RunnerSaaSe.g. Gmail, SlackyouyouyouyouyouyouyouyouyouyouyouproviderproviderprovideryouyouproviderproviderproviderproviderproviderproviderproviderproviderproviderproviderproviderproviderApplicationDataRuntimeOperating systemVirtual machineServers and storageNetworking, buildingblue = you manage itgreen = the provider manages it
Figure 2. Who looks after each layer. The further right you go, the more the provider manages for you, and the less you can customise.
Swipe sideways to see all of it, or tap to open it full screen.

Two more ideas you will meet everywhere:

  • Regions and Availability Zones. A region is a geographic area (for example Mumbai, ap-south-1). Each region has several Availability Zones — separate data centres with their own power and networking. Spreading servers across zones means one building failing doesn't take you down.
  • Shared responsibility. The provider secures the data centres and hardware; you secure what you build on top: who has access, your network rules, your data and your code.

Pets and cattle

Enlarge diagramPets: hand-made serversCattle: servers from codeSet up by hand, each one slightly differentGiven names, like web-prod-1Nursed back to health when sickNobody remembers exactly how it was builtBuilt from code and images, all identicalNumbered and interchangeableReplaced, not repaired, when unhealthyEasy to rebuild, scale up or recreate
Figure 3. "Pets versus cattle": the shift from hand-made servers to servers built and replaced by automation.
Swipe sideways to see all of it, or tap to open it full screen.

Modern DevOps treats servers as cattle: identical, created by automation, replaced rather than repaired. If you find yourself logging into a server to fix it by hand, that fix will be lost the next time the server is replaced — so the fix belongs in code.