Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Secure Three-Tier Web Application

Put a customer portal's web, application and database tiers in a private cloud network so only HTTPS gets in, servers reach only approved outside services, and every engineer and service gets only the access it needs.

Problem statement

Design a web application with three tiers: web servers, application servers and a database. The focus is security: control who can reach each part, what traffic comes in from the internet (ingress) and what traffic goes out to the internet (egress).

A server that an attacker takes over must not be able to reach whatever it likes or send data anywhere.

The application. - For this exercise, assume it is a customer portal: customers sign in, see their account and pay their bills. - Assume it runs in one cloud region across two availability zones (separate data centers in the same region), inside a VPC (virtual private cloud: a private network you define in the cloud, with its own address range split into subnets). - Assume customers reach it at one public hostname over HTTPS. - Assume the database has a primary in one zone and a standby copy in the other.

What it talks to. - Assume the application servers call a payment provider and an email-sending service over HTTPS. Card numbers go straight to the payment provider's own page; the portal keeps only the provider's payment reference. - Assume the web and application servers download software updates from one package mirror on the internet. - Assume a few on-call engineers sometimes need a shell on a server or need to run a database query.

Failures. - Assume losing one zone must not take the site down, and must not open a way around the security controls.

Out of scope. - How customers sign in. - Bugs in the application code, such as SQL injection (an attacker slipping database commands into a form field). Putting a web application firewall (a filter that blocks common attack requests) in front of the site is enough. - Defense against internet-scale DDoS (distributed denial of service: floods of traffic from many machines meant to knock the site offline). - More than one region. - The build and deploy pipeline.

What to build

  1. Customers reach the portal only through its one public hostname over HTTPS; nothing else in the system can be reached from the internet.
  2. Each tier accepts connections only from the tier in front of it, and only the application tier can reach the database.
  3. Servers can reach only the approved outside services: the payment provider, the email service and the package mirror. Every other outbound connection is blocked and logged.
  4. Engineers and services get only the access they need, through an approved path tied to a named identity. Every access and every change to network or access rules is logged and can raise an alert.

At scale

  • For this exercise, assume about 2,000 HTTPS requests per second at peak from customers around the world, served from one region across two zones.
  • For this exercise, assume the application servers make about 100 outbound calls per second at peak to the payment provider and the email service, plus occasional software downloads. The payment provider accepts calls only from a few fixed IP addresses that we register with it.
  • For this exercise, assume about 20 engineers, a few of whom need server or database access during on-call. Each session must be tied to a named person, limited in time and recorded.
  • For this exercise, assume an alert must reach the on-call engineer within 5 minutes of a blocked outbound connection, an access outside the approved path, or a change to firewall or access rules. Security logs are kept for 1 year, and the servers cannot change or delete them.