Skip to content

How do I increase maximum connections for my Amazon Aurora DB instance?

4 minute read
0

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

Resolution

The max_connections parameter in your DB instance parameter group determines the maximum number of connections for an Aurora DB instance. Set this parameter to support all required client connections plus at least three additional connections for AWS automation.

It's a best practice to monitor the usage of resources when you increase the max_connections value. An increase in the number of connections can increase the memory usage, and DB instances that run low on memory might unexpectedly shut down. This issue is more likely to occur with smaller DB instances.

Consult with your database administrator 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. If you choose to scale to a DB instance class with more memory, then it will impact the account's billing.

Use the following methods to increase the maximum number of connections for your Aurora MySQL-Compatible or Aurora PostgresSQL-Compatible DB instance.

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

Determine the max_connection on your instance

To determine the max_connections on your Amazon Aurora instance, use the following LEAST function:

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 automatically scaled with an instance class change, and then adjusted according to the amount of memory on the instance. For more information, see Maximum connections to an Aurora PostgreSQL DB instance.

To check your current settings, use one of the following SQL queries.

Aurora PostgreSQL

postgres=> show max_connections;

-or-

Aurora MySQL

SHOW GLOBAL VARIABLES LIKE 'max_connections';

Use a custom parameter group to set a larger value for max_connections

For Aurora PostgreSQL, use a custom parameter group to set a larger value for max_connections parameter at either the cluster level or instance level.

For Aurora MySQL, use a custom parameter group to set a larger value for max_connections parameter at the instance level.

Complete the following steps:

  1. Create a custom parameter group at either the cluster level or instance level.
    Note: An outage can occur when you change the parameter group.
  2. Associate the custom parameter group with your Amazon Aurora cluster or instance, and then reboot the instance.
  3. After the new custom parameter group is associated with your DB instance, you can increase the max_connections parameter.
    Note: An outage doesn't occur when you increase the max_connections parameter.

Considerations for Aurora Serverless

Aurora Serverless v2 maintains constant max_connections values to prevent dropped connections during scale operations. The default value derives from a formula based on DB instance memory size. For more information, see Maximum connections to an Aurora MySQL DB instance and Maximum connections to an Aurora PostgreSQL DB instance.

Aurora Serverless v2 calculates the formula with memory size from maximum Aurora capacity units (ACUs), not current ACU values. Use formula variations instead of constant values when you change defaults. This approach allows Aurora Serverless v2 to apply appropriate settings based on maximum capacity.

Reboot Aurora Serverless v2 DB instances after you change maximum capacity to update max_connections values. The max_connections parameter is static for Aurora Serverless v2.

Note: For PostgreSQL-compatible DB instances with minimum capacity of 0 or 0.5 ACUs, max_connections caps at 2,000. For more information, see Maximum connections for Aurora Serverless v2

Related information

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

AWS OFFICIALUpdated 2 months ago