AWS RDS connection limits

Solution 1:

AWS RDS max_connections limit variable is based on Instance type, so you can upgrade your RDS or make more replica.

The RDS types with max_connections limit:

  • t2.micro 66
  • t2.small 150
  • m3.medium 296
  • t2.medium 312
  • m3.large 609
  • t2.large 648
  • m4.large 648
  • m3.xlarge 1237
  • r3.large 1258
  • m4.xlarge 1320
  • m2.xlarge 1412
  • m3.2xlarge 2492
  • r3.xlarge 2540

Referring by max_connections at AWS RDS MySQL Instance Sizes in 2015

Update 2017-07

The current RDS MySQL max_connections setting is default by {DBInstanceClassMemory/12582880}, if you use t2.micro with 512MB RAM, the max_connections could be (512*1024*1024)/12582880 ~= 40, and so on.


Each Web server could have many connections to RDS, which depends on your SQL requests from Web server.

Solution 2:

You can change the max_connections value by either updating the default parameter policy or create a new one - I'd suggest going with the latter.

  • Go to RDS
  • Parameter Groups
  • Create a new Parameter Group (AWS wil leave everything as default)
  • search for the max_connections value
  • Change the value to use
  • Go to RDS instance and modify
  • Select new Parameter group created and restart the instance or let AWS reboot it during next maintenance window

Hope this helps!


Solution 3:

Actual info for Postgresql t3-instances (default.postgres10 parameter group):

  • db.t3.micro - 112 max_connections
  • db.t3.small - 225 max_connections
  • db.t3.medium - 450 max_connections
  • db.t3.large - 901 max_connections
  • db.t3.xlarge - 1802 max_connections
  • db.t3.2xlarge - 3604 max_connections

Its similar for default.postgres9 and default.postgres11


Solution 4:

Login to your RDS instance (using a MySQL client) and run the following query:

SHOW VARIABLES LIKE 'max_connections';

Solution 5:

The maximum number of simultaneous database connections varies by the DB engine type and the memory allocation for the DB instance class. The maximum number of connections is set in the parameter group associated with the DB instance, except for Microsoft SQL Server, where it is set in the server properties for the DB instance in SQL Server Managment Studio (SSMS).

MariaDB/MySQL {DBInstanceClassMemory/12582880}

Oracle LEAST({DBInstanceClassMemory/9868951}, 20000)

PostgreSQL LEAST({DBInstanceClassMemory/9531392}, 5000)

SQL Server 0 (unlimited)

https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Limits.html#RDS_Limits.MaxConnections