AWS RDS Max Connections Limit As Per Instance Type

In this article, we’ll explain AWS RDS Max Connections Limit as per Instance Type. Amazon Web Services (AWS) offers a range of cloud-based services, including the Amazon Relational Database Service (RDS), which provides a fully-managed database service for applications. One of the critical considerations when using RDS is the maximum number of connections allowed for a database instance. In this article, we will explore the concept of maximum connections, the factors that affect it, and how to manage it in AWS RDS.

What is the maximum connections limit in AWS RDS?

The maximum connections limit refers to the maximum number of concurrent database connections that can be established to an RDS instance. It is a fundamental parameter that affects the performance, availability, and scalability of the database. The maximum connection limit varies depending on the RDS instance class and the database engine used.

However, reaching the maximum connection limit does not necessarily mean that the database will perform well. Too many active connections can lead to contention and poor performance. It is essential to monitor the database performance and tune the settings accordingly.

What is Max DB Connection?

Determines the maximum number of concurrent connections to the database server. This chart shows the max_connections limit, set by AWS, at various MySQL RDS instance sizes.

AWS sets the MySQL max connections system varies according to the size of the RDS instance. max connections are the maximum permitted number of simultaneous or concurrent client connections.  A “Too many connections” error message may be displayed if this is reached.

If an application implements long-running queries or creates several concurrent connections from the web or app side, the number of connections is just as important as vCPU cores, memory level, or storage IO.

for more info, see the MySQL max_connections sys variable, or AWS’s post regarding DB parameter groups.

AWS RDS Max Connections Limit

In this article, we’re going to explain MySQL RDS Max DB Connection Limits as per DB Instance Type. The current RDS MySQL max_connections setting is default by {DBInstanceClassMemory/12582880}, if you use t2.micro with 1GB RAM the max_connections could be (1024*1024*1024)/12582880 ~= 85.

A solution to “ERROR 1040 (08004): Too many connections

How AWS RDS Max Connections calculated?

You need to convert memory from GB to bytes. So, you will get the DBInstanceClassMemory value and then you divide it by 12582880.

1GB = 1,07,37,41,824‬ bytes (1024 x 1024 x1024)

Maximum Database Connections Chart

DB Engine Parameter Allowed Values Default Value
MariaDB and MySQL max_connections 1–100000 {DBInstanceClassMemory/12582880}
Oracle
processes 80–20000 LEAST({DBInstanceClassMemory/9868951}, 20000)
sessions 100–65535
PostgreSQL max_connections 6–8388607 LEAST({DBInstanceClassMemory/9531392}, 5000)
SQL Server Maximum number of concurrent connections 0–32767 0 (unlimited)


This chart shows the AWS RDS Max Connections Limit set by AWS at various RDS instance sizes.

List Of AWS RDS MySQL max_connections as per instance type

Name API Name Memory GIB vCPUs max_connections
T1 Micro db.t1.micro 0.613 GiB 1 vCPUs 52
T2 General Purpose Micro db.t2.micro 1 GiB 1 vCPUs 85
T3 Micro db.t3.micro 1 GiB 2 vCPUs 85
T4G Micro db.t4g.micro 1 GiB 2 vCPUs 85
M1 General Purpose Small db.m1.small 1.7 GiB 1 vCPUs 145
T2 General Purpose Small db.t2.small 2 GiB 1 vCPUs 171
T3 Small db.t3.small 2 GiB 2 vCPUs 171
T4G Small db.t4g.small 2 GiB 2 vCPUs 171
M1 General Purpose Medium db.m1.medium 3.75 GiB 1 vCPUs 320
M3 General Purpose Medium db.m3.medium 3.75 GiB 1 vCPUs 320
T2 General Purpose Medium db.t2.medium 4 GiB 2 vCPUs 341
T3 Medium db.t3.medium 4 GiB 2 vCPUs 341
T4G Medium db.t4g.medium 4 GiB 2 vCPUs 341
M1 General Purpose Large db.m1.large 7.5 GiB 2 vCPUs 640
M3 General Purpose Large db.m3.large 7.5 GiB 2 vCPUs 640
M4 General Purpose Large db.m4.large 8 GiB 2 vCPUs 683
M5 Large db.m5.large 8 GiB 2 vCPUs 683
M5D Large db.m5d.large 8 GiB 2 vCPUs 683
M6G Large db.m6g.large 8 GiB 2 vCPUs 683
M6GD Large db.m6gd.large 8 GiB 2 vCPUs 683
M6I Large db.m6i.large 8 GiB 2 vCPUs 683
T2 General Purpose Large db.t2.large 8 GiB 2 vCPUs 683
T3 Large db.t3.large 8 GiB 2 vCPUs 683
T4G Large db.t4g.large 8 GiB 2 vCPUs 683
M1 General Purpose Extra Large db.m1.xlarge 15 GiB 4 vCPUs 1280
M3 General Purpose Extra Large db.m3.xlarge 15 GiB 4 vCPUs 1280
R3 Memory Optimized Large db.r3.large 15.25 GiB 2 vCPUs 1301
R4 Memory Optimized Large db.r4.large 15.25 GiB 2 vCPUs 1301
R5 Large db.r5.large 16 GiB 2 vCPUs 1365
R5B Large db.r5b.large 16 GiB 2 vCPUs 1365
R5D Large db.r5d.large 16 GiB 2 vCPUs 1365
R6G Large db.r6g.large 16 GiB 2 vCPUs 1365
R6GD Large db.r6gd.large 16 GiB 2 vCPUs 1365
R6I Large db.r6i.large 16 GiB 2 vCPUs 1365
Z1D Large db.z1d.large 16 GiB 2 vCPUs 1365
M4 General Purpose Extra Large db.m4.xlarge 16 GiB 4 vCPUs 1365
M5 Extra Large db.m5.xlarge 16 GiB 4 vCPUs 1365
M5D Extra Large db.m5d.xlarge 16 GiB 4 vCPUs 1365
M6G Extra Large db.m6g.xlarge 16 GiB 4 vCPUs 1365
M6GD Extra Large db.m6gd.xlarge 16 GiB 4 vCPUs 1365
M6I Extra Large db.m6i.xlarge 16 GiB 4 vCPUs 1365
T2 General Purpose Extra Large db.t2.xlarge 16 GiB 4 vCPUs 1365
T3 Extra Large db.t3.xlarge 16 GiB 4 vCPUs 1365
T4G Extra Large db.t4g.xlarge 16 GiB 4 vCPUs 1365
M2 High Memory Extra Large db.m2.xlarge 17.1 GiB 2 vCPUs 1459
M3 General Purpose Double Extra Large db.m3.2xlarge 30 GiB 8 vCPUs 2560
R3 Memory Optimized Extra Large db.r3.xlarge 30.5 GiB 4 vCPUs 2603
R4 Memory Optimized Extra Large db.r4.xlarge 30.5 GiB 4 vCPUs 2603
R5 Large db.r5.large.tpc1.mem2x 32 GiB 2 vCPUs 2731
R5B Large db.r5b.large.tpc1.mem2x 32 GiB 2 vCPUs 2731
X2G Large db.x2g.large 32 GiB 2 vCPUs 2731
R5 Extra Large db.r5.xlarge 32 GiB 4 vCPUs 2731
R5B Extra Large db.r5b.xlarge 32 GiB 4 vCPUs 2731
R5D Extra Large db.r5d.xlarge 32 GiB 4 vCPUs 2731
R6G Extra Large db.r6g.xlarge 32 GiB 4 vCPUs 2731
R6GD Extra Large db.r6gd.xlarge 32 GiB 4 vCPUs 2731
R6I Extra Large db.r6i.xlarge 32 GiB 4 vCPUs 2731
Z1D Extra Large db.z1d.xlarge 32 GiB 4 vCPUs 2731
M4 General Purpose Double Extra Large db.m4.2xlarge 32 GiB 8 vCPUs 2731
M5 Double Extra Large db.m5.2xlarge 32 GiB 8 vCPUs 2731
M5D Double Extra Large db.m5d.2xlarge 32 GiB 8 vCPUs 2731
M6G Double Extra Large db.m6g.2xlarge 32 GiB 8 vCPUs 2731
M6GD Double Extra Large db.m6gd.2xlarge 32 GiB 8 vCPUs 2731
M6I Double Extra Large db.m6i.2xlarge 32 GiB 8 vCPUs 2731
T2 General Purpose Double Extra Large db.t2.2xlarge 32 GiB 8 vCPUs 2731
T3 Double Extra Large db.t3.2xlarge 32 GiB 8 vCPUs 2731
T4G Double Extra Large db.t4g.2xlarge 32 GiB 8 vCPUs 2731
M2 High Memory Double Extra Large db.m2.2xlarge 34.2 GiB 4 vCPUs 2918
R3 Memory Optimized Double Extra Large db.r3.2xlarge 61 GiB 8 vCPUs 5205
R4 Memory Optimized Double Extra Large db.r4.2xlarge 61 GiB 8 vCPUs 5205
R5 Extra Large db.r5.xlarge.tpc2.mem2x 64 GiB 4 vCPUs 5461
R5B Extra Large db.r5b.xlarge.tpc2.mem2x 64 GiB 4 vCPUs 5461
X2G Extra Large db.x2g.xlarge 64 GiB 4 vCPUs 5461
R5 Double Extra Large db.r5.2xlarge 64 GiB 8 vCPUs 5461
R5B Double Extra Large db.r5b.2xlarge 64 GiB 8 vCPUs 5461
R5D Double Extra Large db.r5d.2xlarge 64 GiB 8 vCPUs 5461
R6G Double Extra Large db.r6g.2xlarge 64 GiB 8 vCPUs 5461
R6GD Double Extra Large db.r6gd.2xlarge 64 GiB 8 vCPUs 5461
R6I Double Extra Large db.r6i.2xlarge 64 GiB 8 vCPUs 5461
Z1D Double Extra Large db.z1d.2xlarge 64 GiB 8 vCPUs 5461
M4 General Purpose Quadruple Extra Large db.m4.4xlarge 64 GiB 16 vCPUs 5461
M5 Quadruple Extra Large db.m5.4xlarge 64 GiB 16 vCPUs 5461
M5D Quadruple Extra Large db.m5d.4xlarge 64 GiB 16 vCPUs 5461
M6G Quadruple Extra Large db.m6g.4xlarge 64 GiB 16 vCPUs 5461
M6GD Quadruple Extra Large db.m6gd.4xlarge 64 GiB 16 vCPUs 5461
M6I Quadruple Extra Large db.m6i.4xlarge 64 GiB 16 vCPUs 5461
M2 High Memory Quadruple Extra Large db.m2.4xlarge 68.4 GiB 8 vCPUs 5837
Z1D 3xlarge db.z1d.3xlarge 96 GiB 12 vCPUs 8192
X1E Extra Large db.x1e.xlarge 122 GiB 4 vCPUs 10411
R3 Memory Optimized Quadruple Extra Large db.r3.4xlarge 122 GiB 16 vCPUs 10411
R4 Memory Optimized Quadruple Extra Large db.r4.4xlarge 122 GiB 16 vCPUs 10411
R5 Extra Large db.r5.xlarge.tpc2.mem4x 128 GiB 4 vCPUs 10923
R5B Extra Large db.r5b.xlarge.tpc2.mem4x 128 GiB 4 vCPUs 10923
X2IEDN Extra Large db.x2iedn.xlarge 128 GiB 4 vCPUs 10923
R5 Double Extra Large db.r5.2xlarge.tpc1.mem2x 128 GiB 8 vCPUs 10923
R5B Double Extra Large db.r5b.2xlarge.tpc1.mem2x 128 GiB 8 vCPUs 10923
X2G Double Extra Large db.x2g.2xlarge 128 GiB 8 vCPUs 10923
R5 Quadruple Extra Large db.r5.4xlarge 128 GiB 16 vCPUs 10923
R5B Quadruple Extra Large db.r5b.4xlarge 128 GiB 16 vCPUs 10923
R5D Quadruple Extra Large db.r5d.4xlarge 128 GiB 16 vCPUs 10923
R6G Quadruple Extra Large db.r6g.4xlarge 128 GiB 16 vCPUs 10923
R6GD Quadruple Extra Large db.r6gd.4xlarge 128 GiB 16 vCPUs 10923
R6I Quadruple Extra Large db.r6i.4xlarge 128 GiB 16 vCPUs 10923
M5 Eight Extra Large db.m5.8xlarge 128 GiB 32 vCPUs 10923
M5D Eight Extra Large db.m5d.8xlarge 128 GiB 32 vCPUs 10923
M6G Eight Extra Large db.m6g.8xlarge 128 GiB 32 vCPUs 10923
M6GD Eight Extra Large db.m6gd.8xlarge 128 GiB 32 vCPUs 10923
M6I Eight Extra Large db.m6i.8xlarge 128 GiB 32 vCPUs 10923
M4 General Purpose Deca Extra Large db.m4.10xlarge 160 GiB 40 vCPUs 13653
Z1D 6xlarge db.z1d.6xlarge 192 GiB 24 vCPUs 16384
M5 12xlarge db.m5.12xlarge 192 GiB 48 vCPUs 16384
M5D 12xlarge db.m5d.12xlarge 192 GiB 48 vCPUs 16384
M6G 12xlarge db.m6g.12xlarge 192 GiB 48 vCPUs 16384
M6GD 12xlarge db.m6gd.12xlarge 192 GiB 48 vCPUs 16384
M6I 12xlarge db.m6i.12xlarge 192 GiB 48 vCPUs 16384
X1E Double Extra Large db.x1e.2xlarge 244 GiB 8 vCPUs 20821
R3 Memory Optimized Eight Extra Large db.r3.8xlarge 244 GiB 32 vCPUs 20821
R4 Memory Optimized Eight Extra Large db.r4.8xlarge 244 GiB 32 vCPUs 20821
R5 Double Extra Large db.r5.2xlarge.tpc2.mem4x 256 GiB 8 vCPUs 21845
R5B Double Extra Large db.r5b.2xlarge.tpc2.mem4x 256 GiB 8 vCPUs 21845
X2IEDN Double Extra Large db.x2iedn.2xlarge 256 GiB 8 vCPUs 21845
X2IEZN Double Extra Large db.x2iezn.2xlarge 256 GiB 8 vCPUs 21845
R5 Quadruple Extra Large db.r5.4xlarge.tpc2.mem2x 256 GiB 16 vCPUs 21845
R5B Quadruple Extra Large db.r5b.4xlarge.tpc2.mem2x 256 GiB 16 vCPUs 21845
X2G Quadruple Extra Large db.x2g.4xlarge 256 GiB 16 vCPUs 21845
R5 Eight Extra Large db.r5.8xlarge 256 GiB 32 vCPUs 21845
R5B Eight Extra Large db.r5b.8xlarge 256 GiB 32 vCPUs 21845
R5D Eight Extra Large db.r5d.8xlarge 256 GiB 32 vCPUs 21845
R6G Eight Extra Large db.r6g.8xlarge 256 GiB 32 vCPUs 21845
R6GD Eight Extra Large db.r6gd.8xlarge 256 GiB 32 vCPUs 21845
R6I Eight Extra Large db.r6i.8xlarge 256 GiB 32 vCPUs 21845
M4 General Purpose 16xlarge db.m4.16xlarge 256 GiB 64 vCPUs 21845
M5 16xlarge db.m5.16xlarge 256 GiB 64 vCPUs 21845
M5D 16xlarge db.m5d.16xlarge 256 GiB 64 vCPUs 21845
M6G 16xlarge db.m6g.16xlarge 256 GiB 64 vCPUs 21845
M6GD 16xlarge db.m6gd.16xlarge 256 GiB 64 vCPUs 21845
M6I 16xlarge db.m6i.16xlarge 256 GiB 64 vCPUs 21845
R5 Quadruple Extra Large db.r5.4xlarge.tpc2.mem3x 384 GiB 16 vCPUs 32768
R5B Quadruple Extra Large db.r5b.4xlarge.tpc2.mem3x 384 GiB 16 vCPUs 32768
R5 12xlarge db.r5.12xlarge 384 GiB 48 vCPUs 32768
R5B 12xlarge db.r5b.12xlarge 384 GiB 48 vCPUs 32768
R5D 12xlarge db.r5d.12xlarge 384 GiB 48 vCPUs 32768
R6G 12xlarge db.r6g.12xlarge 384 GiB 48 vCPUs 32768
R6GD 12xlarge db.r6gd.12xlarge 384 GiB 48 vCPUs 32768
R6I 12xlarge db.r6i.12xlarge 384 GiB 48 vCPUs 32768
Z1D 12xlarge db.z1d.12xlarge 384 GiB 48 vCPUs 32768
M5 24xlarge db.m5.24xlarge 384 GiB 96 vCPUs 32768
M5D 24xlarge db.m5d.24xlarge 384 GiB 96 vCPUs 32768
M6I 24xlarge db.m6i.24xlarge 384 GiB 96 vCPUs 32768
X1E Quadruple Extra Large db.x1e.4xlarge 488 GiB 16 vCPUs 41643
R4 Memory Optimized 16xlarge db.r4.16xlarge 488 GiB 64 vCPUs 41643
R5 Double Extra Large db.r5.2xlarge.tpc2.mem8x 512 GiB 8 vCPUs 43691
R5B Double Extra Large db.r5b.2xlarge.tpc2.mem8x 512 GiB 8 vCPUs 43691
R5 Quadruple Extra Large db.r5.4xlarge.tpc2.mem4x 512 GiB 16 vCPUs 43691
R5B Quadruple Extra Large db.r5b.4xlarge.tpc2.mem4x 512 GiB 16 vCPUs 43691
X2IEDN Quadruple Extra Large db.x2iedn.4xlarge 512 GiB 16 vCPUs 43691
X2IEZN Quadruple Extra Large db.x2iezn.4xlarge 512 GiB 16 vCPUs 43691
X2G Eight Extra Large db.x2g.8xlarge 512 GiB 32 vCPUs 43691
R5 16xlarge db.r5.16xlarge 512 GiB 64 vCPUs 43691
R5B 16xlarge db.r5b.16xlarge 512 GiB 64 vCPUs 43691
R5D 16xlarge db.r5d.16xlarge 512 GiB 64 vCPUs 43691
R6G 16xlarge db.r6g.16xlarge 512 GiB 64 vCPUs 43691
R6GD 16xlarge db.r6gd.16xlarge 512 GiB 64 vCPUs 43691
R6I 16xlarge db.r6i.16xlarge 512 GiB 64 vCPUs 43691
M6I 32xlarge db.m6i.32xlarge 512 GiB 128 vCPUs 43691
R5 6xlarge db.r5.6xlarge.tpc2.mem4x 768 GiB 24 vCPUs 65536
R5B 6xlarge db.r5b.6xlarge.tpc2.mem4x 768 GiB 24 vCPUs 65536
X2IEZN 6xlarge db.x2iezn.6xlarge 768 GiB 24 vCPUs 65536
R5 Eight Extra Large db.r5.8xlarge.tpc2.mem3x 768 GiB 32 vCPUs 65536
R5B Eight Extra Large db.r5b.8xlarge.tpc2.mem3x 768 GiB 32 vCPUs 65536
R5 12xlarge db.r5.12xlarge.tpc2.mem2x 768 GiB 48 vCPUs 65536
R5B 12xlarge db.r5b.12xlarge.tpc2.mem2x 768 GiB 48 vCPUs 65536
X2G 12xlarge db.x2g.12xlarge 768 GiB 48 vCPUs 65536
R5 24xlarge db.r5.24xlarge 768 GiB 96 vCPUs 65536
R5B 24xlarge db.r5b.24xlarge 768 GiB 96 vCPUs 65536
R5D 24xlarge db.r5d.24xlarge 768 GiB 96 vCPUs 65536
R6I 24xlarge db.r6i.24xlarge 768 GiB 96 vCPUs 65536
X1E Eight Extra Large db.x1e.8xlarge 976 GiB 32 vCPUs 83286
X1 16xlarge db.x1.16xlarge 976 GiB 64 vCPUs 83286
X2IEDN Eight Extra Large db.x2iedn.8xlarge 1024 GiB 32 vCPUs 87382
X2IEZN Eight Extra Large db.x2iezn.8xlarge 1024 GiB 32 vCPUs 87382
X2G 16xlarge db.x2g.16xlarge 1024 GiB 64 vCPUs 87382
X2IDN 16xlarge db.x2idn.16xlarge 1024 GiB 64 vCPUs 87382
R6I 32xlarge db.r6i.32xlarge 1024 GiB 128 vCPUs 87382
X2IEZN 12xlarge db.x2iezn.12xlarge 1536 GiB 48 vCPUs 131072
X2IDN 24xlarge db.x2idn.24xlarge 1536 GiB 96 vCPUs 131072
X1E 16xlarge db.x1e.16xlarge 1952 GiB 64 vCPUs 166571
X1 32xlarge db.x1.32xlarge 1952 GiB 128 vCPUs 166571
X2IEDN 16xlarge db.x2iedn.16xlarge 2048 GiB 64 vCPUs 174763
X2IDN 32xlarge db.x2idn.32xlarge 2048 GiB 128 vCPUs 174763
X2IEDN 24xlarge db.x2iedn.24xlarge 3072 GiB 96 vCPUs 262145
X1E 32xlarge db.x1e.32xlarge 3904 GiB 128 vCPUs 333142
X2IEDN 32xlarge db.x2iedn.32xlarge 4096 GiB 128 vCPUs 349526

When running a standby server, you must set this parameter to the same or higher value than on the master server. Otherwise, queries will not be allowed on the standby server.

Do you know that, by default, each instance comes with a different number of max_connections?

Command to check max_db_connection in MySQL DB

# mysql>show max_connections;
You can only modify parameter values in a custom DB parameter group, which means the DB parameter group which you have created not the one which is provided by AWS. Because you can’t change the parameter values in a default DB parameter group.

You will get the below error if you try to update values in the “default parameter group”.

Error: Cannot modify a default parameter group. (Service: AmazonRDS; Status Code: 400; Error Code: InvalidParameterValue;

Steps to Create a DB Parameter Group

Step 1: Log in to the AWS console

Step 2: Navigate to the RDS service and choose Parameter Groups.

Step 3: Click on Create Parameter Group, and select the DB parameter group family.

Step 4: Provide the name for the new DB parameter group and save it

Steps to Update Max Connection in RDS

Step 1: Login to AWS Console

Step 2: Navigate RDS Service

Step 3: Click on the Parameter Group

AWS RDS Max Connections Limit

Step 4: Search for max_connections and you’ll see the formula.

In my case, it’s {DBInstanceClassMemory/31457280}.

­­­­­­
AWS RDS Max Connections Limit

Step 5: Update the max_connections to 100 (check the value as per your instance type) and save the changes, no need to reboot.

Note: Reboot required when you have created a new parameter group and assign it to RDS.
AWS RDS Max Connections Limit

Note: No downtime is required for this activity. when you update values in the custom DB parameter group and it is already attached to the RDS instance.

If you have created a new DB parameter group then continue with the below steps:

Step 6: Go-to RDS instance and modify

Step 7: Select the new Parameter group created and choose to apply the immediate setting.

This will require/auto-restart the instance or there is another option you can choose to reboot the instance on the next AWS maintenance window.

Hope this helps!

This is the end of the article, where we have listed AWS RDS Max_connection Limits as per DB Instance Type.

If you found this article informative then don’t miss to read the below articles.

See Also: