How do I increase the max connections of my Amazon Aurora DB instance?

3 minute read
0

I want to increase the max connections for my Amazon Aurora PostgreSQL-Compatible Edition or MySQL-Compatible Edition DB instance.

Resolution

Increase the maximum number of connections to your Aurora MySQL-Compatible or Aurora PostgresSQL-Compatible DB instance by using the following methods.

Set a larger value for max_connections using a custom parameter group

Set a larger value for the max_connections parameter by using a custom cluster-level or instance-level parameter group. Increasing the max_connections parameter doesn't cause any outage. Even though you can increase the value of max_connections beyond the default value, it's not a best practice. This is because the DB instance might run into issues when workload increases. An increase in the number of connections can increase the memory usage, and DB instances running low on memory might crash. This is true especially for smaller DB instances.

If you increase the max_connections value, then be sure to monitor the usage of resources. Also, consult with your DBA about the increase. It's a best practice to keep the default value, or scale up to a larger instance class when more connections are required. With Aurora, you can use the LEAST function to determine the max_connections:

LEAST({DBInstanceClassMemory/9531392},5000)

This function selects the math equation with the DBInstanceClass until it's equal to or over 5,000. This means it's scaled automatically with an instance class change, and then adjusted accordingly to the memory on the instance. For more information, see Maximum connections to an Aurora PostgreSQL DB instance.

Change a default parameter group to a custom parameter group

If your DB cluster or instance uses a default parameter group, then change the default parameter group to a custom parameter group. You can do this at either the cluster-level or instance-level. Be sure to associate the custom DB parameter group with your Aurora cluster or instance, and then reboot the instance. After the new custom parameter group is associated with your DB instance, you can modify the max_connections parameter value.

Note: Changing the parameter group can cause an outage. For more information, see Working with DB cluster parameter groups.

Scale up your instance class

Scale your DB instance up to a DB instance class with more memory. Scaling up Amazon Relational Database Service (Amazon RDS) instances, including Amazon Aurora instances, impacts the account’s billing. To learn more, see DB instance billing for Aurora.

Note: Downtime occurs when you modify an Amazon Aurora DB cluster.

Considerations for Aurora Serverless

For Amazon Aurora Serverless v1, the max_connections aren't configurable in a parameter group or by you. Instead, max_connections depends on the Aurora Capacity Units (ACU) that's associated with the cluster. For more information, see Determining the maximum number of database connections for Aurora Serverless v1.

For Aurora Serverless v2, setting max_connections can cause the instance to scale up. This happens because the memory allocation is taken up from the current number of connections on the instance. This forces a scaling point, and then increases the memory and CPU allocation to the instance. This memory increase happens at the cost of increasing current active connections to meet the max_connections allocated.

Note: Setting max_connections can increase the billing for your instance because Aurora Serverless is bound by an ACU/hour cost. For more information about Aurora Serverless pricing, see Amazon Aurora pricing.


Related information

How do I increase the max connections of my Amazon RDS for MySQL or Amazon RDS for PostgreSQL instance?

AWS OFFICIAL
AWS OFFICIALUpdated a year ago