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,
});
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"])
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
})
}
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,
});
});
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());
}
}
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}
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 string
- The unique name of the resource.
- args ConnectionPoolArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args 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 string
- The unique name of the resource.
- args ConnectionPoolArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ConnectionPoolArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args 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",
});
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"),
})
var connectionPoolResource = new ConnectionPool("connectionPoolResource", ConnectionPoolArgs.builder()
.databaseName("string")
.poolName("string")
.project("string")
.serviceName("string")
.poolMode("string")
.poolSize(0)
.username("string")
.build());
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")
const connectionPoolResource = new aiven.ConnectionPool("connectionPoolResource", {
databaseName: "string",
poolName: "string",
project: "string",
serviceName: "string",
poolMode: "string",
poolSize: 0,
username: "string",
});
type: aiven:ConnectionPool
properties:
databaseName: string
poolMode: string
poolName: string
poolSize: 0
project: string
serviceName: string
username: string
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:
- Database
Name 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.
- Pool
Name string - Name of the pool. Changing this property forces recreation of the resource.
- Project 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.
- Service
Name 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.
- Pool
Mode string - The operational mode. The possible values are
session
,transaction
andstatement
. The default value istransaction
. - 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 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 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.
- Pool
Name string - Name of the pool. Changing this property forces recreation of the resource.
- Project 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.
- Service
Name 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.
- Pool
Mode string - The operational mode. The possible values are
session
,transaction
andstatement
. The default value istransaction
. - 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 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 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.
- pool
Name String - Name of the pool. Changing this property forces recreation of the resource.
- project 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.
- service
Name 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.
- pool
Mode String - The operational mode. The possible values are
session
,transaction
andstatement
. The default value istransaction
. - pool
Size 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.
- database
Name 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.
- pool
Name string - Name of the pool. Changing this property forces recreation of the resource.
- project 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.
- service
Name 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.
- pool
Mode string - The operational mode. The possible values are
session
,transaction
andstatement
. The default value istransaction
. - pool
Size 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 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 str - Name of the pool. Changing this property forces recreation of the resource.
- project 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 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
,transaction
andstatement
. The default value istransaction
. - 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.
- database
Name 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.
- pool
Name String - Name of the pool. Changing this property forces recreation of the resource.
- project 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.
- service
Name 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.
- pool
Mode String - The operational mode. The possible values are
session
,transaction
andstatement
. The default value istransaction
. - pool
Size 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:
- Connection
Uri string - The URI for connecting to the pool.
- Id string
- The provider-assigned unique ID for this managed resource.
- Connection
Uri string - The URI for connecting to the pool.
- Id string
- The provider-assigned unique ID for this managed resource.
- connection
Uri String - The URI for connecting to the pool.
- id String
- The provider-assigned unique ID for this managed resource.
- connection
Uri 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.
- connection
Uri 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)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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.
- Connection
Uri string - The URI for connecting to the pool.
- Database
Name 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.
- Pool
Mode string - The operational mode. The possible values are
session
,transaction
andstatement
. The default value istransaction
. - Pool
Name string - 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 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.
- Service
Name 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 string - The URI for connecting to the pool.
- Database
Name 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.
- Pool
Mode string - The operational mode. The possible values are
session
,transaction
andstatement
. The default value istransaction
. - Pool
Name string - 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 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.
- Service
Name 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 String - The URI for connecting to the pool.
- database
Name 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.
- pool
Mode String - The operational mode. The possible values are
session
,transaction
andstatement
. The default value istransaction
. - pool
Name String - Name of the pool. Changing this property forces recreation of the resource.
- pool
Size 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 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.
- service
Name 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 string - The URI for connecting to the pool.
- database
Name 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.
- pool
Mode string - The operational mode. The possible values are
session
,transaction
andstatement
. The default value istransaction
. - pool
Name string - Name of the pool. Changing this property forces recreation of the resource.
- pool
Size 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 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.
- service
Name 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 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
,transaction
andstatement
. The default value istransaction
. - pool_
name 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 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 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.
- connection
Uri String - The URI for connecting to the pool.
- database
Name 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.
- pool
Mode String - The operational mode. The possible values are
session
,transaction
andstatement
. The default value istransaction
. - pool
Name String - Name of the pool. Changing this property forces recreation of the resource.
- pool
Size 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 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.
- service
Name 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
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.