Skip to content
Cloud architecture templates

Teaching Case — A Database in a Public Subnet

Deliberately wrong, and the drawing of it is indistinguishable from a correct one — which is the point. The database sits in a subnet the document itself declares public, and the traffic path from the internet reaches it without passing through anything that terminates or filters. The engine names both, with the path it walked, so a reader can check the accusation rather than take it.

Template previewCloud architecture
Order service — as first drawnAn AWS architecture diagram: 4 resources in 6 scopes (1 network, 1 availability zone), joined by 3 connections. Categories drawn: Compute, Databases, Networking, Clients. 2 errors and 1 warning across 4 resources and 3 edges; 1 of the 10 checks could not run at all.Order service — as first drawnAWS · 4 resources · 6 scopes · 1 network · 1 zone · 3 connections2 errors and 1 warning across 4 resources and 3 edges; 1 of the 10 checks could not run at all.Internetintern…7AccountProducti…7Regioneu-west…7NetworkVPC10.0.0.0/167+Availability zoneeu-west-…7SubnetPublic sub…10.0.1.0…public2+Anyone on theinternet—1+Internetgatewayaws5+Web serveraws1+Customer databaseaws1+https 443postgres 5432LegendComputeDatabasesNetworkingClientsRequest trafficDepends onChecks — what ran, and what could notWhether the internet reaches something that ho…1 finding over 3 subjectsWhether anything holding data at rest sits in …1 finding over 1 subjectWhether anything claiming redundancy is spread…could not run here — 1 reason givenEdges that leave one network for another, or c…1 finding over 3 subjectsResources that appear in no edge at all. A leg…ran over 4 subjects, found nothingEvery id an edge or a scope names is one that …ran over 4 subjects, found nothingEach id is declared once. Two declarations mak…ran over 10 subjects, found nothingType words that did not resolve. A hole in thi…ran over 4 subjects, found nothingDeclared ranges: that each parses, sits inside…ran over 2 subjects, found nothingWhether every line was read and no shape cap b…ran over 10 subjects, found nothingFindings1`db` (RDS) holds data at rest and is reached from the internet in 2 hops with no ingress on the way: `anyone` then `web` then `db`.in the figure: anyone, web, dbpath: anyone → web → db2`db` (RDS) holds data at rest and sits in `pub`, a subnet this document declares public: whatever can route to the subnet can route to it, drawn or not.in the figure: db (badge 1), pub3The edge from `anyone` to `web` crosses from the internet (`internet`) to network `vpc` with nothing named to carry it: either a gateway is missing from thearchitecture, or it is in the architecture and missing from this picture.in the figure: anyone (badge 1), web (badge 1)41 zone is declared, but nothing claims redundancy and no tier has more than one member, so this check ran over nothing. Write `ha` or `multi-az` on what is meant to beredundant and it runs.5All 4 declared resources appear in at least one edge.in the figure: anyone (badge 1), gw, web (badge 1), db (badge 1)6All 4 ids named by edges and scopes were declared somewhere in this document.in the figure: anyone (badge 1), web (badge 1), db (badge 1), gw (badge 5)7All 10 declared ids are distinct.in the figure: internet, prod, eu-west-1, vpc, eu-west-1a +5 more8All 4 resources resolved to a type this engine knows, so every check above had the full vocabulary to read.in the figure: anyone (badge 1), gw (badge 5), web (badge 1), db (badge 1)9All 2 declared ranges parse, the one drawn inside an addressed network sits inside it, and no two ranges under one parent share an address. The one subnet that hasinstances drawn in it holds them. Ranges under different parents were not compared — two networks numbered alike is ordinary and correct.in the figure: vpc (badge 7), pub (badge 2)10Every line was read and no shape cap bit: the 10 declarations above are the whole document, so the counts are totals rather than floors.

Make it your own.

title "Order service — as first drawn"
provider aws
note "Deliberately wrong. See the findings under the figure."

internet {
  user anyone "Anyone on the internet"
}

cloud prod "Production" {
  region eu-west-1 {
    network vpc "VPC" cidr 10.0.0.0/16 {
      igw gw "Internet gateway"

      zone eu-west-1a {
        subnet pub "Public subnet" public cidr 10.0.1.0/24 {
          ec2 web "Web server"
          rds db "Customer database"
        }
      }
    }
  }
}

anyone -> web : https 443
web -> db : postgres 5432
web ..> gw