Re-factor duplicate code for limiting RDS instances.