What you're actually renting when you launch a server, how the network and firewalls around it work, what drives the bill, and how containers and Kubernetes run on top — then how to stand up cloud infrastructure yourself, public or self-hosted. Hands-on, with the real commands.
When you "launch a server" in the cloud, no one racks a new machine for you. You get a slice of a big physical host, carved out by a hypervisor — a virtual machine, which cloud providers call an instance. Understanding what that slice really is saves you from both over-paying and mysterious slowdowns.
A provider runs enormous physical servers — dozens of CPU cores, hundreds of GB of RAM. A hypervisor (the virtualization layer from the OS course) splits each host into many isolated instances, each believing it's a whole computer. You rent one instance; your neighbours rent others on the same metal, invisible to you.
An instance is specified by a size — a bundle of four things:
Providers group sizes into families tuned for different ratios: general purpose (balanced), compute-optimized (more vCPU per GB), memory-optimized (the reverse, for databases and caches), and accelerated (GPUs, for ML). Picking the right family is the highest-leverage cost decision you make.
This trips everyone up: a vCPU is not a dedicated physical core. It's usually a hardware thread — a share of a physical core's time, scheduled by the hypervisor. On most general-purpose instances a vCPU ≈ one thread of a hyper-threaded core, so two vCPUs often share one physical core.
Providers often allocate more vCPUs across all the instances on a host than there are physical threads, betting that not everyone is busy at once. This is overcommit, and it's great economics — until several tenants spike together and contend for the same cores ("noisy neighbours"). Burstable instance types lean into this cheaply; dedicated or metal instances avoid it at a premium. Memory is usually overcommitted far less — RAM is harder to share than CPU time, so when you buy 8 GB you more reliably get 8 GB.
Drag the sliders to see overcommit in action on one physical host:
An instance in isolation is useless — it needs to be reachable (by the right people) and protected (from everyone else). Cloud networking gives you a private, software-defined network you fully control, and security groups are the firewalls guarding each instance.
Your VPC (Virtual Private Cloud; "VNet" on Azure) is your own isolated slice of the provider's network — a private address space that's yours alone. Inside it you define everything: IP ranges, subnets, routing, gateways. Nothing gets in or out except by rules you set.
You carve the VPC into subnets — smaller IP ranges (written in CIDR notation like 10.0.1.0/24, meaning 256 addresses). The key distinction:
Put anything internet-facing (load balancer, web tier) in a public subnet; put everything precious (databases, internal services, your PRAGMA backbone) in a private subnet. The public tier talks to the private tier internally; the private tier is never directly exposed. For a lender handling customer data, this public/private split is table stakes.
A security group is a stateful virtual firewall attached to an instance (or several). It's a list of allow rules — there's no explicit deny, because the default is to deny everything. You open only what you need:
Define inbound rules and test traffic against them — this is exactly how a packet is evaluated at the instance's edge:
A related but coarser tool is the network ACL — a stateless firewall at the subnet boundary, with explicit allow and deny rules. Security groups (per-instance, stateful) are what you'll use day to day; ACLs are a second, broader layer.
Cloud flips the old model: instead of buying servers up front (capex), you rent by the second (opex). Liberating — and dangerous, because it's just as easy to rent and forget. Knowing what you're charged for, and the three ways to pay, is what keeps the bill sane.
| Charge | Billed by | Watch out for |
|---|---|---|
| Compute (instances) | per second/hour running | idle instances left on — the #1 waste |
| Storage | per GB-month | orphaned disks & snapshots nobody deleted |
| Data transfer (egress) | per GB leaving the cloud | the silent killer — see below |
| Managed services | per request / per hour | convenient but marked up |
Data coming in is almost always free. Data going out to the internet — or across regions — is charged per GB and adds up shockingly fast. Keeping your compute, storage and database in the same region (so traffic between them is free) is the single biggest architectural cost lever, exactly as it was for the PRAGMA training run.
Estimate a monthly bill and feel how the model and the hours change it:
The biggest savings aren't clever — they're hygiene: turn off idle instances, delete orphaned storage, right-size over-provisioned boxes, set budget alerts, and tag everything so you know what each dollar is for.
A VM virtualizes a whole machine; a container virtualizes just the OS, packaging one application plus its dependencies into a unit that runs identically everywhere. "Works on my machine" dies here. Docker is the tool that made containers mainstream.
The one distinction to internalise: an image is the blueprint (a read-only template of your app + its environment); a container is a running instance of that image. Class and object. You build an image once and run many identical containers from it.
You describe the image in a Dockerfile — a recipe, each line a layer that's cached for fast rebuilds:
FROM python:3.12-slim # base image to build on
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt # cached unless reqs change
COPY . . # your app code
EXPOSE 8000
CMD ["python", "app.py"] # what runs on start# build an image from the Dockerfile, tag it
docker build -t myapp:1.0 .
# run a container: map host port 8000 -> container 8000
docker run -d -p 8000:8000 --name web myapp:1.0
# push to a registry so others / the cloud can pull it
docker tag myapp:1.0 registry.example.com/myapp:1.0
docker push registry.example.com/myapp:1.0
docker ps # list running containers
docker logs web # see its output
docker stop web # stop itKey runtime flags: -p maps ports (host:container), -v mounts volumes for data that must survive the container (containers are ephemeral — delete one and its internal changes vanish), and -e injects environment variables for config.
Real apps are several containers — web + database + cache. Docker Compose defines them together in one file:
services:
web:
build: .
ports: ["8000:8000"]
depends_on: [db]
db:
image: postgres:16
environment:
POSTGRES_PASSWORD: secret
volumes: ["pgdata:/var/lib/postgresql/data"]
volumes:
pgdata:docker compose up starts the whole stack. Compose is great for one machine — but to run containers across many machines, reliably, at scale, you need orchestration. Enter Kubernetes.
Docker runs a container on one machine. Kubernetes (K8s) runs thousands across a fleet, and keeps them running — restarting crashed ones, rescheduling off dead machines, scaling with load, and rolling out new versions without downtime. It's a control system built on one idea: desired state.
You don't tell Kubernetes "start this container here." You declare "I want 5 copies of this running," and K8s continuously works to make reality match. A pod dies? It starts another. A machine fails? It reschedules elsewhere. This constant reconciliation of actual toward desired is the whole philosophy — and the source of self-healing.
A cluster has a control plane (the brain) and worker nodes (the muscle). The control plane runs the API server (the front door), the scheduler (decides which node runs each pod), the controller manager (the reconcilers), and etcd (the database holding the desired state). Each worker runs a kubelet that starts the pods it's assigned. You talk to the API server with kubectl:
apiVersion: apps/v1
kind: Deployment
metadata: {name: web}
spec:
replicas: 5 # desired state
selector: {matchLabels: {app: web}}
template:
metadata: {labels: {app: web}}
spec:
containers:
- name: web
image: registry.example.com/myapp:1.0
ports: [{containerPort: 8000}]
# apply it, then watch K8s make it real
# kubectl apply -f deployment.yaml
# kubectl get pods (list pods)
# kubectl scale deploy/web --replicas=8 (scale)Change replicas below, and kill pods or a whole node — watch Kubernetes heal back to the desired count:
Everything so far has been concepts and single commands. This module is the "how do I actually build this" — and the first real decision: rent a public cloud, or run your own with open-source software like OpenStack. Both have their place, and for an African lender, data residency can tip the balance.
Fastest to start, nothing to maintain, pay-as-you-go. The setup skeleton (AWS flavour, but the shape is universal):
# 1. identity: create an account, set up IAM users/roles (never use root daily)
# 2. network: create a VPC with a public + private subnet
# 3. security: a security group opening only what you need
# 4. launch an instance into the subnet
aws ec2 run-instances --image-id ami-xxxx --instance-type t3.large \
--subnet-id subnet-xxxx --security-group-ids sg-xxxx --key-name mykey
# 5. for containers: use the managed Kubernetes (EKS / GKE / AKS)
# so you don't run the control plane yourselfClicking through a console doesn't scale and isn't repeatable. Define your infrastructure in code with Terraform — the same declarative, desired-state idea as Kubernetes, but for the whole cloud. One file, version-controlled, reproducible across environments:
resource "aws_instance" "web" {
ami = "ami-xxxx"
instance_type = "t3.large"
subnet_id = aws_subnet.public.id
tags = { Name = "web-server" }
}
# terraform plan (preview changes)
# terraform apply (make them real)OpenStack is the leading open-source platform for building a private (or public) cloud on your own hardware — it's the software that turns a rack of servers into an AWS-like, self-service cloud with instances, networks, and volumes. It's modular; the core components map directly to what you've learned:
| Component | Role | Public-cloud analogue |
|---|---|---|
| Nova | Compute — launches instances | EC2 |
| Neutron | Networking — VPCs, subnets, security groups | VPC |
| Cinder | Block storage — volumes | EBS |
| Glance | Image service — VM templates | AMIs |
| Keystone | Identity & auth | IAM |
| Horizon | Web dashboard | Console |
# --- To LEARN: DevStack (all-in-one on a single VM, not for production) ---
git clone https://opendev.org/openstack/devstack
cd devstack && cp samples/local.conf .
./stack.sh # ~20-40 min; gives you a full OpenStack to explore
# --- For PRODUCTION: deploy with Kolla-Ansible (containerised OpenStack) ---
# 1. prepare controller + compute nodes (OS, network, SSH keys)
# 2. pip install kolla-ansible; configure globals.yml + inventory
# 3. kolla-ansible bootstrap-servers (prep the hosts)
# 4. kolla-ansible deploy (stand up all services)
# then drive it like any cloud:
openstack server create --flavor m1.small --image ubuntu \
--network private myinstance(Apache CloudStack is a simpler open-source alternative — a single management server over your hypervisors, quicker to stand up, less modular. Worth a look if OpenStack feels heavy.)
| Choose public cloud when… | Choose private (OpenStack) when… |
|---|---|
| You want speed and zero ops burden | Data residency / sovereignty rules require on-soil hosting |
| Demand is spiky or unpredictable | Load is large, steady, and predictable (owning beats renting) |
| You're small or moving fast | You have the team to operate infrastructure |
| You need global reach quickly | You need full control over hardware and locality |
Start on public cloud — the speed and low commitment are worth it while you're proving things out. Revisit private/OpenStack only when the numbers (steady large spend) or the rules (per-market data-residency requirements, a real factor across African regulators) genuinely demand it. Many teams end up hybrid: public cloud for burst and global reach, owned infrastructure where data must stay home.
From the vCPU slice of a physical host, through the VPC and security groups around it, the billing that governs it, the Docker image that packages your app, the Kubernetes cluster that runs it at scale, up to standing up the whole cloud yourself — you now have the end-to-end picture of modern infrastructure, and the commands to start building it.