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: falsefor 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
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
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: trueallows a public address. Routes and security groups determine who can reach it. - After:
PubliclyAccessible: falseremoves the public address. Private connections still need security-group permission and database authentication.