RDS instance enables public access

A public address can provide an external connection path to an RDS instance. Define the required access scope and manage public accessibility together with network permissions.

Description

PubliclyAccessible controls public addressing for an AWS::RDS::DBInstance. If omitted, the default can vary with the VPC and DB subnet group.

Potential impact

Even if access is restricted today, a later route or security-group change can let unintended clients reach a publicly addressed database. Data access still requires authentication and privileges.

Remediation

  • Prepare private connectivity for applications and administrators, then set PubliclyAccessible: false for an internal database. Check the deployed value and test those connections.
  • Review routes for every subnet in the DB subnet group. If public access is required, allow only approved sources and DB ports, authenticate clients and encrypt traffic.

Examples

Supply the subnet group and security groups. Choose a region-supported Engine, EngineVersion and instance class. Replace the sample password SecretPassword01 with a supported option such as RDS-managed credentials in Secrets Manager.

Before

yaml
Resources:
  MyDB:
    Type: "AWS::RDS::DBInstance"
    Properties:
      DBInstanceIdentifier: mydbinstance
      DBName: mydb
      DBInstanceClass: db.m5.large
      AllocatedStorage: 50
      Engine: MySQL
      EngineVersion: 8.0.16
      MasterUsername: admin
      MasterUserPassword: SecretPassword01
      PubliclyAccessible: true

After

yaml
Resources:
  MyDB:
    Type: "AWS::RDS::DBInstance"
    Properties:
      DBInstanceIdentifier: mydbinstance
      DBName: mydb
      DBInstanceClass: db.m5.large
      AllocatedStorage: 50
      Engine: MySQL
      EngineVersion: 8.0.16
      MasterUsername: admin
      MasterUserPassword: SecretPassword01
      PubliclyAccessible: false

Explanation:

  • Before: PubliclyAccessible: true allows a public address. Routes and security groups determine who can reach it.
  • After: PubliclyAccessible: false removes the public address. Private connections still need security-group permission and database authentication.

References