1. Packages
  2. Aiven Provider
  3. API Docs
  4. ConnectionPool
Aiven v6.37.0 published on Thursday, Apr 10, 2025 by Pulumi

aiven.ConnectionPool

Explore with Pulumi AI

Creates and manages a connection pool in an Aiven for PostgreSQL® service.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aiven from "@pulumi/aiven";

const main = new aiven.ConnectionPool("main", {
    project: exampleProject.project,
    serviceName: examplePostgres.serviceName,
    databaseName: mainAivenPgDatabase.databaseName,
    poolMode: "transaction",
    poolName: "example-pool",
    poolSize: 10,
    username: exampleUser.username,
});
Copy
import pulumi
import pulumi_aiven as aiven

main = aiven.ConnectionPool("main",
    project=example_project["project"],
    service_name=example_postgres["serviceName"],
    database_name=main_aiven_pg_database["databaseName"],
    pool_mode="transaction",
    pool_name="example-pool",
    pool_size=10,
    username=example_user["username"])
Copy
package main

import (
	"github.com/pulumi/pulumi-aiven/sdk/v6/go/aiven"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := aiven.NewConnectionPool(ctx, "main", &aiven.ConnectionPoolArgs{
			Project:      pulumi.Any(exampleProject.Project),
			ServiceName:  pulumi.Any(examplePostgres.ServiceName),
			DatabaseName: pulumi.Any(mainAivenPgDatabase.DatabaseName),
			PoolMode:     pulumi.String("transaction"),
			PoolName:     pulumi.String("example-pool"),
			PoolSize:     pulumi.Int(10),
			Username:     pulumi.Any(exampleUser.Username),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aiven = Pulumi.Aiven;

return await Deployment.RunAsync(() => 
{
    var main = new Aiven.ConnectionPool("main", new()
    {
        Project = exampleProject.Project,
        ServiceName = examplePostgres.ServiceName,
        DatabaseName = mainAivenPgDatabase.DatabaseName,
        PoolMode = "transaction",
        PoolName = "example-pool",
        PoolSize = 10,
        Username = exampleUser.Username,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aiven.ConnectionPool;
import com.pulumi.aiven.ConnectionPoolArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var main = new ConnectionPool("main", ConnectionPoolArgs.builder()
            .project(exampleProject.project())
            .serviceName(examplePostgres.serviceName())
            .databaseName(mainAivenPgDatabase.databaseName())
            .poolMode("transaction")
            .poolName("example-pool")
            .poolSize(10)
            .username(exampleUser.username())
            .build());

    }
}
Copy
resources:
  main:
    type: aiven:ConnectionPool
    properties:
      project: ${exampleProject.project}
      serviceName: ${examplePostgres.serviceName}
      databaseName: ${mainAivenPgDatabase.databaseName}
      poolMode: transaction
      poolName: example-pool
      poolSize: 10
      username: ${exampleUser.username}
Copy

Create ConnectionPool Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new ConnectionPool(name: string, args: ConnectionPoolArgs, opts?: CustomResourceOptions);
@overload
def ConnectionPool(resource_name: str,
                   args: ConnectionPoolArgs,
                   opts: Optional[ResourceOptions] = None)

@overload
def ConnectionPool(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   database_name: Optional[str] = None,
                   pool_name: Optional[str] = None,
                   project: Optional[str] = None,
                   service_name: Optional[str] = None,
                   pool_mode: Optional[str] = None,
                   pool_size: Optional[int] = None,
                   username: Optional[str] = None)
func NewConnectionPool(ctx *Context, name string, args ConnectionPoolArgs, opts ...ResourceOption) (*ConnectionPool, error)
public ConnectionPool(string name, ConnectionPoolArgs args, CustomResourceOptions? opts = null)
public ConnectionPool(String name, ConnectionPoolArgs args)
public ConnectionPool(String name, ConnectionPoolArgs args, CustomResourceOptions options)
type: aiven:ConnectionPool
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ConnectionPoolArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ConnectionPoolArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ConnectionPoolArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ConnectionPoolArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ConnectionPoolArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var connectionPoolResource = new Aiven.ConnectionPool("connectionPoolResource", new()
{
    DatabaseName = "string",
    PoolName = "string",
    Project = "string",
    ServiceName = "string",
    PoolMode = "string",
    PoolSize = 0,
    Username = "string",
});
Copy
example, err := aiven.NewConnectionPool(ctx, "connectionPoolResource", &aiven.ConnectionPoolArgs{
	DatabaseName: pulumi.String("string"),
	PoolName:     pulumi.String("string"),
	Project:      pulumi.String("string"),
	ServiceName:  pulumi.String("string"),
	PoolMode:     pulumi.String("string"),
	PoolSize:     pulumi.Int(0),
	Username:     pulumi.String("string"),
})
Copy
var connectionPoolResource = new ConnectionPool("connectionPoolResource", ConnectionPoolArgs.builder()
    .databaseName("string")
    .poolName("string")
    .project("string")
    .serviceName("string")
    .poolMode("string")
    .poolSize(0)
    .username("string")
    .build());
Copy
connection_pool_resource = aiven.ConnectionPool("connectionPoolResource",
    database_name="string",
    pool_name="string",
    project="string",
    service_name="string",
    pool_mode="string",
    pool_size=0,
    username="string")
Copy
const connectionPoolResource = new aiven.ConnectionPool("connectionPoolResource", {
    databaseName: "string",
    poolName: "string",
    project: "string",
    serviceName: "string",
    poolMode: "string",
    poolSize: 0,
    username: "string",
});
Copy
type: aiven:ConnectionPool
properties:
    databaseName: string
    poolMode: string
    poolName: string
    poolSize: 0
    project: string
    serviceName: string
    username: string
Copy

ConnectionPool Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The ConnectionPool resource accepts the following input properties:

DatabaseName
This property is required.
Changes to this property will trigger replacement.
string
The name of the database the pool connects to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
PoolName
This property is required.
Changes to this property will trigger replacement.
string
Name of the pool. Changing this property forces recreation of the resource.
Project
This property is required.
Changes to this property will trigger replacement.
string
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
ServiceName
This property is required.
Changes to this property will trigger replacement.
string
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
PoolMode string
The operational mode. The possible values are session, statement and transaction. The default value is transaction.
PoolSize int
The number of PostgreSQL server connections this pool can use at a time. This does not affect the number of incoming connections. Each pool can handle a minimum of 5000 client connections. The default value is 10.
Username string
The name of the service user used to connect to the database. To set up proper dependencies please refer to this variable as a reference.
DatabaseName
This property is required.
Changes to this property will trigger replacement.
string
The name of the database the pool connects to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
PoolName
This property is required.
Changes to this property will trigger replacement.
string
Name of the pool. Changing this property forces recreation of the resource.
Project
This property is required.
Changes to this property will trigger replacement.
string
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
ServiceName
This property is required.
Changes to this property will trigger replacement.
string
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
PoolMode string
The operational mode. The possible values are session, statement and transaction. The default value is transaction.
PoolSize int
The number of PostgreSQL server connections this pool can use at a time. This does not affect the number of incoming connections. Each pool can handle a minimum of 5000 client connections. The default value is 10.
Username string
The name of the service user used to connect to the database. To set up proper dependencies please refer to this variable as a reference.
databaseName
This property is required.
Changes to this property will trigger replacement.
String
The name of the database the pool connects to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
poolName
This property is required.
Changes to this property will trigger replacement.
String
Name of the pool. Changing this property forces recreation of the resource.
project
This property is required.
Changes to this property will trigger replacement.
String
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
serviceName
This property is required.
Changes to this property will trigger replacement.
String
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
poolMode String
The operational mode. The possible values are session, statement and transaction. The default value is transaction.
poolSize Integer
The number of PostgreSQL server connections this pool can use at a time. This does not affect the number of incoming connections. Each pool can handle a minimum of 5000 client connections. The default value is 10.
username String
The name of the service user used to connect to the database. To set up proper dependencies please refer to this variable as a reference.
databaseName
This property is required.
Changes to this property will trigger replacement.
string
The name of the database the pool connects to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
poolName
This property is required.
Changes to this property will trigger replacement.
string
Name of the pool. Changing this property forces recreation of the resource.
project
This property is required.
Changes to this property will trigger replacement.
string
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
serviceName
This property is required.
Changes to this property will trigger replacement.
string
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
poolMode string
The operational mode. The possible values are session, statement and transaction. The default value is transaction.
poolSize number
The number of PostgreSQL server connections this pool can use at a time. This does not affect the number of incoming connections. Each pool can handle a minimum of 5000 client connections. The default value is 10.
username string
The name of the service user used to connect to the database. To set up proper dependencies please refer to this variable as a reference.
database_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the database the pool connects to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
pool_name
This property is required.
Changes to this property will trigger replacement.
str
Name of the pool. Changing this property forces recreation of the resource.
project
This property is required.
Changes to this property will trigger replacement.
str
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
service_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
pool_mode str
The operational mode. The possible values are session, statement and transaction. The default value is transaction.
pool_size int
The number of PostgreSQL server connections this pool can use at a time. This does not affect the number of incoming connections. Each pool can handle a minimum of 5000 client connections. The default value is 10.
username str
The name of the service user used to connect to the database. To set up proper dependencies please refer to this variable as a reference.
databaseName
This property is required.
Changes to this property will trigger replacement.
String
The name of the database the pool connects to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
poolName
This property is required.
Changes to this property will trigger replacement.
String
Name of the pool. Changing this property forces recreation of the resource.
project
This property is required.
Changes to this property will trigger replacement.
String
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
serviceName
This property is required.
Changes to this property will trigger replacement.
String
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
poolMode String
The operational mode. The possible values are session, statement and transaction. The default value is transaction.
poolSize Number
The number of PostgreSQL server connections this pool can use at a time. This does not affect the number of incoming connections. Each pool can handle a minimum of 5000 client connections. The default value is 10.
username String
The name of the service user used to connect to the database. To set up proper dependencies please refer to this variable as a reference.

Outputs

All input properties are implicitly available as output properties. Additionally, the ConnectionPool resource produces the following output properties:

ConnectionUri string
The URI for connecting to the pool.
Id string
The provider-assigned unique ID for this managed resource.
ConnectionUri string
The URI for connecting to the pool.
Id string
The provider-assigned unique ID for this managed resource.
connectionUri String
The URI for connecting to the pool.
id String
The provider-assigned unique ID for this managed resource.
connectionUri string
The URI for connecting to the pool.
id string
The provider-assigned unique ID for this managed resource.
connection_uri str
The URI for connecting to the pool.
id str
The provider-assigned unique ID for this managed resource.
connectionUri String
The URI for connecting to the pool.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing ConnectionPool Resource

Get an existing ConnectionPool resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ConnectionPoolState, opts?: CustomResourceOptions): ConnectionPool
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        connection_uri: Optional[str] = None,
        database_name: Optional[str] = None,
        pool_mode: Optional[str] = None,
        pool_name: Optional[str] = None,
        pool_size: Optional[int] = None,
        project: Optional[str] = None,
        service_name: Optional[str] = None,
        username: Optional[str] = None) -> ConnectionPool
func GetConnectionPool(ctx *Context, name string, id IDInput, state *ConnectionPoolState, opts ...ResourceOption) (*ConnectionPool, error)
public static ConnectionPool Get(string name, Input<string> id, ConnectionPoolState? state, CustomResourceOptions? opts = null)
public static ConnectionPool get(String name, Output<String> id, ConnectionPoolState state, CustomResourceOptions options)
resources:  _:    type: aiven:ConnectionPool    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
ConnectionUri string
The URI for connecting to the pool.
DatabaseName Changes to this property will trigger replacement. string
The name of the database the pool connects to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
PoolMode string
The operational mode. The possible values are session, statement and transaction. The default value is transaction.
PoolName Changes to this property will trigger replacement. string
Name of the pool. Changing this property forces recreation of the resource.
PoolSize int
The number of PostgreSQL server connections this pool can use at a time. This does not affect the number of incoming connections. Each pool can handle a minimum of 5000 client connections. The default value is 10.
Project Changes to this property will trigger replacement. string
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
ServiceName Changes to this property will trigger replacement. string
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
Username string
The name of the service user used to connect to the database. To set up proper dependencies please refer to this variable as a reference.
ConnectionUri string
The URI for connecting to the pool.
DatabaseName Changes to this property will trigger replacement. string
The name of the database the pool connects to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
PoolMode string
The operational mode. The possible values are session, statement and transaction. The default value is transaction.
PoolName Changes to this property will trigger replacement. string
Name of the pool. Changing this property forces recreation of the resource.
PoolSize int
The number of PostgreSQL server connections this pool can use at a time. This does not affect the number of incoming connections. Each pool can handle a minimum of 5000 client connections. The default value is 10.
Project Changes to this property will trigger replacement. string
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
ServiceName Changes to this property will trigger replacement. string
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
Username string
The name of the service user used to connect to the database. To set up proper dependencies please refer to this variable as a reference.
connectionUri String
The URI for connecting to the pool.
databaseName Changes to this property will trigger replacement. String
The name of the database the pool connects to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
poolMode String
The operational mode. The possible values are session, statement and transaction. The default value is transaction.
poolName Changes to this property will trigger replacement. String
Name of the pool. Changing this property forces recreation of the resource.
poolSize Integer
The number of PostgreSQL server connections this pool can use at a time. This does not affect the number of incoming connections. Each pool can handle a minimum of 5000 client connections. The default value is 10.
project Changes to this property will trigger replacement. String
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
serviceName Changes to this property will trigger replacement. String
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
username String
The name of the service user used to connect to the database. To set up proper dependencies please refer to this variable as a reference.
connectionUri string
The URI for connecting to the pool.
databaseName Changes to this property will trigger replacement. string
The name of the database the pool connects to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
poolMode string
The operational mode. The possible values are session, statement and transaction. The default value is transaction.
poolName Changes to this property will trigger replacement. string
Name of the pool. Changing this property forces recreation of the resource.
poolSize number
The number of PostgreSQL server connections this pool can use at a time. This does not affect the number of incoming connections. Each pool can handle a minimum of 5000 client connections. The default value is 10.
project Changes to this property will trigger replacement. string
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
serviceName Changes to this property will trigger replacement. string
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
username string
The name of the service user used to connect to the database. To set up proper dependencies please refer to this variable as a reference.
connection_uri str
The URI for connecting to the pool.
database_name Changes to this property will trigger replacement. str
The name of the database the pool connects to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
pool_mode str
The operational mode. The possible values are session, statement and transaction. The default value is transaction.
pool_name Changes to this property will trigger replacement. str
Name of the pool. Changing this property forces recreation of the resource.
pool_size int
The number of PostgreSQL server connections this pool can use at a time. This does not affect the number of incoming connections. Each pool can handle a minimum of 5000 client connections. The default value is 10.
project Changes to this property will trigger replacement. str
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
service_name Changes to this property will trigger replacement. str
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
username str
The name of the service user used to connect to the database. To set up proper dependencies please refer to this variable as a reference.
connectionUri String
The URI for connecting to the pool.
databaseName Changes to this property will trigger replacement. String
The name of the database the pool connects to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
poolMode String
The operational mode. The possible values are session, statement and transaction. The default value is transaction.
poolName Changes to this property will trigger replacement. String
Name of the pool. Changing this property forces recreation of the resource.
poolSize Number
The number of PostgreSQL server connections this pool can use at a time. This does not affect the number of incoming connections. Each pool can handle a minimum of 5000 client connections. The default value is 10.
project Changes to this property will trigger replacement. String
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
serviceName Changes to this property will trigger replacement. String
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
username String
The name of the service user used to connect to the database. To set up proper dependencies please refer to this variable as a reference.

Import

$ pulumi import aiven:index/connectionPool:ConnectionPool main PROJECT/SERVICE_NAME/POOL_NAME
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Aiven pulumi/pulumi-aiven
License
Apache-2.0
Notes
This Pulumi package is based on the aiven Terraform Provider.