RDS Snapshot Restores Silently Reset PubliclyAccessible
Overview
An Amazon RDS snapshot or point-in-time restore does not keep the source instance's PubliclyAccessible setting; it applies CreateDBInstance's defaults, which depend on the DB subnet group, so a restored copy of a private database can come up public.
At a glance
- Symptom
- A DR runbook or Terraform apply calls the restore API without the flag, and the API defaults it to true.
- Likely cause
- Restoring an RDS instance from a snapshot or point-in-time without explicitly passing PubliclyAccessible=false.
- Impact
- The restored database gets a public endpoint despite a VPC-only security group, and a later rule change exposes it to the internet unnoticed.
- Verification signal
- Re-run the detection test and a controlled negative-path test.
- Safe correction
- Force --no-publicly-accessible on every restore call and enforce it centrally with the rds-instance-public-access-check Config rule and auto-remediation.
- Rollback or recovery
- Restore the exported configuration if the new control blocks required production traffic, then narrow the policy before redeployment.
The Trap
RestoreDBInstanceFromDBSnapshot and RestoreDBInstanceToPointInTime can default PubliclyAccessible to true
The Default State
Most engineers assume the setting is inherited from the source instance or safely off by default across the RDS API surface. It is not.
When you call RestoreDBInstanceFromDBSnapshot or RestoreDBInstanceToPointInTime and omit the PubliclyAccessible parameter, RDS applies the same defaults as CreateDBInstance, not the source instance’s setting: with no DBSubnetGroupName it defaults to true for non-Aurora engines, and with the subnet group named default it also defaults to true.
Console restores need the same care: check the public access setting in the restore wizard rather than assuming it is off. Terraform’s aws_db_instance defaults publicly_accessible to false, so the risk there is an ignore_changes lifecycle rule on that attribute, which lets a true value set by a manual console restore during an incident survive every later apply.
The Blast Radius
Disaster recovery runbooks and point-in-time restores are usually executed under time pressure, precisely when nobody is re-checking network flags. The restored instance receives a public DNS name and a public IP on its ENI.
The security group may still list only the VPC CIDR, but the endpoint is now internet-routable, which means any later security group edit, VPC peering misconfiguration, or a stale 0.0.0.0/0 rule left from testing turns a private database into an internet-facing one instantly, with no deployment event to flag it.
Once a security group rule does admit the traffic, internet-wide scanners and Shodan-style crawlers can find the endpoint and read the engine’s version banner, giving attackers version and patch-level intelligence for free.
The Lead Mechanic Fix
Never omit the flag on a restore call. Run aws rds restore-db-instance-from-db-snapshot --db-snapshot-identifier <snap> --db-instance-identifier <name> --no-publicly-accessible and the equivalent for RestoreDBInstanceToPointInTime. Enforce this with the AWS Config managed rule rds-instance-public-access-check paired with the SSM automation document AWSConfigRemediation-DisablePublicAccessToRDSInstance for automatic remediation, and set Terraform’s publicly_accessible explicitly to false on every db_instance resource with no ignore_changes lifecycle block masking drift.
Apply the safer control
Before you change production
Confirm the affected scope, export the current configuration, and test the replacement control in a non-production environment first.
Fix commands and configuration
aws rds restore-db-instance-from-db-snapshot --db-snapshot-identifier <snap> --db-instance-identifier <name> --no-publicly-accessiblerds-instance-public-access-checkAWSConfigRemediation-DisablePublicAccessToRDSInstanceVerify, roll back or escalate
Verify
Re-run the detection test and a controlled negative-path test. Confirm the unsafe behaviour is blocked while approved traffic still succeeds.
Rollback
Restore the exported configuration if the new control blocks required production traffic, then narrow the policy before redeployment.
Escalate
Escalate when the blast radius is uncertain, the control cannot be tested safely, or remediation requires an outage or security exception.
Fixed? Get the next one before it hits you: The KBY Brief
Practical fixes for the systems you run, by email about twice a week. Unsubscribe at any time.
About this page
Credited to
Dates
Published
Last updated
Corrections
No corrections are listed for this page. Some review sweeps corrected pages without naming each one; those are in the corrections log.
Was this useful?
Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.


