Network layout: public at the edge, data kept private

Open to the internet only what visitors must reach. Keep apps and databases on private addresses, and let security groups decide who may talk to whom.

InternetYour visitorsVPC 10.10.0.0/16 · shop-prodSubnet web10.10.1.0/24ContainerOpen to the internetwebSubnet app10.10.2.0/24ContainerInside the VPC onlyapiSubnet data10.10.3.0/24DatabaseNo public endpointdbHTTPS:8080:5432Security groupsOnly the arrows are open; the rest is closedNAT GatewayA fixed IP of your ownBank / partnerAllowlists your IP
Visitors reach only the web tier. The app tier and database are reached on private addresses, on the ports the security groups open, and the app tier goes out to partners through one fixed IP.

Split the VPC into tiers

  • Web: the container visitors reach, with Access open to the internet.
  • App: APIs and background workers, with Access set to inside the VPC only. Turn on the Invoker token too if only certain callers should reach it.
  • Data: databases with the public endpoint turned off. Apps reach them at server-name.internal.

Tag services, then write rules by tag

In VPC > Security groups, give each service a tag for its role, such as web, api or db. Then make a group for each tier that opens only the port it needs: web to api on 8080, and api to db on 5432. Rules only allow; whatever no rule names stays closed.

New services join the Default group, where they reach each other on every port. For production, once each service has its own group, take it out of the Default group, so a problem in one service can’t reach everything else.

A fixed outgoing IP only where it’s needed

If a bank or partner allowlists your IP, create a NAT Gateway and send only the app tier’s subnet through it (see NAT Gateway). Other subnets keep the shared outgoing IP at no extra cost.

Working on a production database from your computer

Turn on the public endpoint only while you need it, allow only your own IP, and turn it off again afterwards. Connections always use TLS.

Joining projects

  • Peer production with shared tools, not with testing. Give testing its own copy of what it needs.
  • Peering opens nothing on its own. After both sides accept, add a security group rule that names the peered VPC or a group it shares (see Security groups and VPC peering).
  • Peering joins two VPCs in one region and isn’t transitive: if A peers with B and B with C, A still can’t reach C. For three or more projects, or across regions, use a Network Hub.

Many projects, offices or regions: a Star hub with a firewall

shared-tools · CenterDatabase · monitoring · internal APIshop-prod · EdgeWebsite · Containerpos-prod · EdgeContainers · CacheVPN Site-to-SiteHead office and branchesVPN Client-to-SiteStaff laptops and phonesNetwork Hub · StarOwned by shared-toolsFirewallBetween spokes + to the internetOnly through the firewallInternetFrom the firewall’s fixed IPs
Edges reach the center, and reach each other only through the firewall where a rule allows it. Offices and staff come in over VPN, and every project goes out to the internet through the firewall.
  • Create the hub in the shared-tools project and make that project the Center: databases, monitoring and internal APIs every team uses live there.
  • Attach each production project as an Edge. Edges reach the center but not each other, so a problem in one project can’t spread to the next.
  • Bring offices in with a Site-to-Site VPN gateway and staff with a Client-to-Site one, instead of opening databases to the internet (see VPN Gateway).
  • Add a firewall to the hub: Between spokes allows only the connections you expect, and To the internet sends every project out from the same fixed IPs, with one place to control them (see Firewall on a Network Hub).
  • Keep testing off the production hub. If testing needs a hub, give it its own.
  • Security groups still apply in every VPC: the hub and the firewall let a connection reach the VPC, and the service’s security group must allow it too.

Still stuck? Let our team help

Open a ticket from the Console. Tell us the site or service, what you did and the message on screen. Our reply comes back in the same ticket, so everything stays in one place.