Skip to main content

Putting Other Workloads in a DB Subnet Group's Subnets Can Leave RDS No Free IP Address for Failover and Maintenance

High severityAmazon Web Services About 20 minutes to fix

Overview

RDS needs spare addresses in its subnets to fail over. Check how many are free before the next maintenance window.

At a glance

Symptom
A planned instance-class change, a maintenance event or a failover goes wrong, though the same operation worked months earlier.
Likely cause
RDS chooses a subnet and an IP address within the DB subnet group for the instance, and creates a network interface with that address.
Impact
You cannot rely on the next failover or maintenance event completing cleanly, and an instance in the incompatible-network state cannot be modified or rebooted.
Verification signal
The fix holds when each subnet in the group reports free addresses in AvailableIpAddressCount, the instance status returns to available, and a modification or a reboot is accepted…
Safe correction
Before changing anything, make sure a recent backup exists, because an instance in the incompatible-network state may not be reachable for a logical backup.
Rollback or recovery
Moving workloads back into the subnets is the one step that reintroduces the fault, so keep the list of what moved.

RDS needs spare IP addresses in the subnets of a DB subnet group to fail over, replace a host or change instance class. When other resources use up those subnets, the database keeps running until the first maintenance event or failover that needs a new address. Then the instance can stop accepting changes and reboots.

The fix is to keep free addresses in every subnet the group holds, and to enlarge the group with matching subnets rather than trying to repair the instance.

Symptom

A planned instance-class change, a maintenance event or a failover goes wrong, though the same operation worked months earlier. The instance may end up in the incompatible-network state. AWS describes it as a state where the database might still be accessible but cannot be modified or rebooted. Its recent events carry a classification, and IP CHECK means there are no free IP addresses in your subnets.

The database may still answer queries while the console refuses every change, which sends people looking at the database engine rather than at the network.

Why this looks safe

The change that sets this up is a routine tidy-up: the private subnets that hold the database are also the ones with spare room, so other workloads are placed there, or the subnets were created small to save address space. Each step is valid, nothing fails on the day, and the database keeps its existing address, so it looks unaffected.

The assumption is that an instance has taken its address and will not need another. RDS does need more, at times you do not control.

Root cause

RDS chooses a subnet and an IP address within the DB subnet group for the instance, and creates a network interface with that address. AWS states that the CIDR block of each subnet must leave spare addresses for RDS to use during maintenance activities, including failover and compute scaling.

After a failure of the primary in a Multi-AZ deployment, RDS can promote the standby and later create a new standby with an address from a subnet in one of the other Availability Zones.

AWS also says to reserve at least one address in every subnet of the group for recovery actions. If other resources have taken every free address, RDS has none to allocate. The documented causes of the incompatible-network state include modifying the instance class and replacing a host because of a maintenance event, so the exhaustion surfaces during ordinary operations.

Impact

You cannot rely on the next failover or maintenance event completing cleanly, and an instance in the incompatible-network state cannot be modified or rebooted. The exposure builds up quietly, because nothing alerts when a subnet is nearly full. AWS also notes that once an instance is in that state, it might not be accessible for a logical backup, so recovery then depends on backups made earlier.

Two tempting shortcuts

The first is to run start-db-instance again and again. AWS offers it as the first repair for the state, but warns that it might cause downtime and that the instance might return to the incompatible-network state if the cause is still there. With IP CHECK the cause is the full subnet, so repeating it only repeats the downtime.

The second is to add any subnet with free space to the DB subnet group, such as a public one. For a publicly accessible instance, AWS says all subnets in the group must be public and that public and private subnets should not be mixed. Changing a subnet from public to private makes instances in it unreachable from outside the VPC. A related note covers why changes to the public access flag take effect later than expected.

How to confirm the diagnosis without changing anything

These checks only read

  1. Check the instance’s status and subnets. Run aws rds describe-db-instances --db-instance-identifier mydb --query "DBInstances[0].[DBInstanceStatus,DBSubnetGroup.Subnets[].SubnetIdentifier]".
  2. Count the free addresses in those subnets. Run aws ec2 describe-subnets --subnet-ids subnet-0a1111111111aaaaa subnet-0b2222222222bbbbb --query "Subnets[].[SubnetId,CidrBlock,AvailableIpAddressCount]". A subnet at or near zero is the cause.
  3. Read the instance’s events for the last day with aws rds describe-events --source-type db-instance --source-identifier mydb --duration 1440, and look for the IP CHECK classification or a failover that did not complete. The default window is 60 minutes.

Following along? Tap a step’s number to tick it off.

If every subnet has plenty of free addresses, the cause is something else. The other classifications in the same list, such as SECURITY GROUP CHECK and SUBNET CHECK, point to different faults.

Correction

Before changing anything, make sure a recent backup exists, because an instance in the incompatible-network state may not be reachable for a logical backup. Then, in this order:

  1. Free addresses in the affected subnets by moving other workloads out of them. Remove nothing that RDS owns.
  2. Re-run the subnet check and confirm each subnet in the group shows free addresses, at least one and ideally more.
  3. Only if the state persists, run aws rds start-db-instance --db-instance-identifier mydb, accepting that it might cause downtime, in a window the application owners have agreed.
  4. For a lasting fix, create a subnet of adequate size in each Availability Zone the group uses, then add them with aws rds modify-db-subnet-group --db-subnet-group-name mydbsubnetgroup --subnet-ids subnet-0a1111111111aaaaa subnet-0b2222222222bbbbb subnet-0c3333333333ccccc. The command requires --subnet-ids and names the subnets the group should hold, so list every existing subnet as well as the new ones. A group needs subnets in at least two Availability Zones. The new subnets must match the existing ones in visibility, and may not be mixed public and private for a publicly accessible instance.

Validation

The fix holds when each subnet in the group reports free addresses in AvailableIpAddressCount, the instance status returns to available, and a modification or a reboot is accepted again. For a Multi-AZ instance, confirm the Multi-AZ instance failover completed event after a failover in a non-production copy, rather than the Availability Zone shown in the console.

Rollback

Moving workloads back into the subnets is the one step that reintroduces the fault, so keep the list of what moved. A subnet group change can be reversed by running the same modify command with the previous subnet list, but only for subnets that no instance depends on. If a restore is needed, use the backup taken before the work started.

Stop it happening again

Treat the DB subnet group’s subnets as reserved for RDS: do not place other workloads in them, and size each subnet for failover and compute scaling, not only for today’s instances. Alert on AvailableIpAddressCount for those subnets and review it before any instance-class change or planned maintenance. Define subnets in two or more Availability Zones so RDS can create a new standby in another zone.

3

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

incompatible-network
IP CHECK
start-db-instance
4

When to escalate

Validation and rollback are covered in the sections above.

Escalate

Escalate when the blast radius is uncertain, the control cannot be tested safely, or remediation requires an outage or security exception.

The KBY Brief

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

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.

Found this useful? Follow KBY for more like it.

After remediation

Further reading stays below the corrective workflow and is selected by platform, category and shared technical keywords.

More from KBY that goes with this config trap.

Discover more

Connected KBY resources