A database open to the internet
To debug a connection issue, an engineer widens a security group.
ingress {
from_port = 5432
to_port = 5432
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}This opens Postgres to the whole internet. Restrict cidr_blocks to the application subnet or reference the app security group instead.
Result: A temporary debugging change doesn't become a permanent exposure.