Skip to content

Firewalls and subnets

Choose who may connect with allowed sources, admit a database in your own firewall rules, and leave room in its subnet.

Updated View as Markdown

Allowed sources

A database’s allowedSourceCidrs are the IPv4 CIDRs that may connect to it, 1 to 20 of them. Left out, they’re the VPC’s ranges. Nothing else can connect, except through ezgh databases connect and the console’s Query (Connect without entering your VPC).

ezgh databases update dbi_4k2m9x0a7qpe --allowed-source-cidr 10.0.1.0/24 --allowed-source-cidr 10.0.2.0/24

The list replaces the previous one, and applies with no interruption. In the console, it’s Allowed sources on the database’s Connectivity tab.

Your own firewalls can’t be attached to a database: allowed sources decide who reaches it.

Firewall rules

Your instances’ firewalls must allow their traffic to the database. A firewall that allows all outbound traffic, as a new one does, needs nothing more. Otherwise, add an outbound rule whose peer is the database. It stays right however the database changes, and you never need to know its addresses.

{
  "direction": "outbound",
  "protocol": "tcp",
  "ports": { "from": 5432, "to": 5432 },
  "peer": { "database": "dbi_4k2m9x0a7qpe" }
}
ezgh compute firewalls rules add app --direction outbound --protocol tcp \
  --ports 5432 --peer-database dbi_4k2m9x0a7qpe
  • Each database you admit takes one of an interface’s 8 firewall references.
  • You need databases.databases.get on the database to name it in a rule.
  • A database named in a rule can’t be deleted: that’s 409 database_in_use. Delete the rule first.

Subnets

A database takes addresses in its subnet, and more for a while during maintenance and blue/green deployments. Create it in a subnet with at least 16 free addresses. A create in a subnet that’s out of room is refused with 409 subnet_has_no_room.

A subnet or VPC with a database in it can’t be deleted: that’s 409 database_in_use, naming the database. Delete the database first.

A database stays in its subnet. To move one, restore it into another subnet of the project.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close