RDS DB instances should not be deployed in public subnets with routes to internet gateways
Flags RDS DB instances whose DB subnet group includes any subnet with an active route to an internet gateway, whatever its destination; a subnet with no route table of its own is judged by its VPC's main one. A private subnet keeps the database off the internet whatever its other settings say, and turning off public access (RDS.2) does not clear this.
- service
- RDS
- severity
- High
- scope
- evaluated in every region
How to fix it
- Interrupts service: Changing the DB subnet group causes an outage, at the next maintenance window unless you apply it immediately.
- Can break clients: Removing the internet gateway route from those subnets' route tables also clears this (the in-place fix for RDS Custom), but cuts internet access for everything else in them.
In the console
RDS → Databases → the DB instance → Modify (build the private group first at RDS → Subnet groups)
- DB subnet group
- One built only from private subnets, covering at least two Availability Zones
With the AWS CLI
aws rds modify-db-instance --db-instance-identifier <db-instance-id> --db-subnet-group-name <private-db-subnet-group> --region <region>With Terraform
resource "aws_db_instance" "this" {
db_subnet_group_name = aws_db_subnet_group.private.name
instance_class = var.instance_class
}
See which of your accounts this check is failing on.
Book a live scan