GC
← All work

Project · Architecture

Highly available web app on Azure

A web tier that keeps serving when a server — or a whole availability zone — fails. Everything is Terraform, and every change is formatted, validated, linted, security-scanned and priced before it can deploy.

Terraform · Standard Load Balancer · VM Scale Set · Availability Zones · Autoscale · Azure Monitor · GitHub Actions (OIDC)

Servers
3+, one per zone
Survives
A datacenter failure
Scaling
Autoscale 3–10 on CPU
Entry
Load balancer only

The flow

From a visitor to a healthy server.

Azure region · TerraformVNet · subnet · NSG 80/443 onlyVM scale set · auto-repairZone 1Zone 2Zone 3healthy onlyoutbound rulescale outmetricsVMVMVMVisitorsHTTPS 443Public IPstaticzone-redundantLoad BalancerStandardprobe /health123Autoscale3–10 VMs · CPU > 70%Azure Monitoralerts → email admin45Zone 1Zone 2Zone 3Azure regionVNet · NSGScale sethealthy onlyoutbound rulescale outmetricsVisitorsHTTPS 443Public IPstatic · zone-redundant1Load BalancerStandard · probe /health2VMVMVMAutoscale3–10 · CPU > 70%Azure Monitoralerts → email453
  1. 1Visitors hit one static, zone-redundant IP.
  2. 2The load balancer only sends traffic to servers that pass the /health probe.
  3. 3Servers sit in three zones. If a whole zone fails, the other two keep serving, and a failed server is replaced automatically.
  4. 4Autoscale adds servers above 70% CPU, up to 10.
  5. 5Azure Monitor watches the metrics and emails the admin.

Key decisions

Every choice has a reason.

  • Availability zones, not an availability set. A set protects one datacenter; zones survive a whole datacenter failing.
  • Scale set, not standalone VMs. Autoscale, rolling patches, self-healing and automatic load-balancer membership come built in.
  • Standard Load Balancer. Basic is retired; Standard is zone-redundant and closed by default.
  • Load balancer outbound rule, not NAT Gateway. Servers only go out for OS updates, so there's no need for the extra cost.
  • No public IPs on the servers. The load balancer is the only way in; the NSG allows only 80/443.
  • Encryption at host. The temp disk and host caches are encrypted too, not just the disks at rest.

Delivery

From commit to cloud, safely.

Checks · all must passGitHub Actionsevery changefmt · validatelintCheckovInfracostOIDC loginno stored secretterraform applyreviewed planStateblob lease lockChecks · all must passGitHub Actionsevery changefmt · validatelintCheckovInfracostOIDC loginno stored secretterraform applyreviewed planStateblob lease lock

A GitHub Actions pipeline runs on every change: format, validate, lint, security scan (Checkov) and a cost estimate (Infracost). It deploys with OIDC — no stored password, nothing to leak. Terraform state lives in Azure Storage with Entra ID auth and a blob lease for locking, and the reviewed plan is exactly what gets applied.