@@ -606,11 +606,47 @@ public readonly lambdaFunction: Function;
606606
607607### PgStacDatabase <a name =" PgStacDatabase " id =" eoapi-cdk.PgStacDatabase " ></a >
608608
609- An RDS instance with pgSTAC installed.
609+ An RDS instance with pgSTAC installed and PgBouncer connection pooling .
610610
611- This is a wrapper around the
612- ` rds.DatabaseInstance ` higher-level construct making use
613- of the BootstrapPgStac construct.
611+ This construct creates an optimized pgSTAC database setup that includes:
612+ - RDS PostgreSQL instance with pgSTAC extension
613+ - PgBouncer connection pooler (enabled by default)
614+ - Automated health monitoring system
615+ - Optimized database parameters for the selected instance type
616+
617+ ## Connection Pooling with PgBouncer
618+
619+ By default, this construct deploys PgBouncer as a connection pooler running on
620+ a dedicated EC2 instance. PgBouncer provides several benefits:
621+
622+ - ** Connection Management** : Pools and reuses database connections to reduce overhead
623+ - ** Performance** : Optimizes connection handling for high-traffic applications
624+ - ** Scalability** : Allows more concurrent connections than the RDS instance alone
625+ - ** Health Monitoring** : Includes comprehensive health checks to ensure availability
626+
627+ ### PgBouncer Configuration
628+ - Pool mode: Transaction-level pooling (default)
629+ - Maximum client connections: 1000
630+ - Default pool size: 20 connections per database/user combination
631+ - Instance type: t3.micro EC2 instance
632+
633+ ### Health Check System
634+ The construct includes an automated health check system that validates:
635+ - PgBouncer service is running and listening on port 5432
636+ - Connection tests to ensure accessibility
637+ - Cloud-init setup completion before validation
638+ - Detailed diagnostics for troubleshooting
639+
640+ ### Connection Details
641+ When PgBouncer is enabled, applications connect through the PgBouncer instance
642+ rather than directly to RDS. The ` pgstacSecret ` contains connection information
643+ pointing to PgBouncer, and the ` connectionTarget ` property refers to the
644+ PgBouncer EC2 instance.
645+
646+ To disable PgBouncer and connect directly to RDS, set ` addPgbouncer: false ` .
647+
648+ This is a wrapper around the ` rds.DatabaseInstance ` higher-level construct
649+ making use of the BootstrapPgStac construct.
614650
615651#### Initializers <a name =" Initializers " id =" eoapi-cdk.PgStacDatabase.Initializer " ></a >
616652
@@ -728,6 +764,7 @@ Any object.
728764| <code ><a href =" #eoapi-cdk.PgStacDatabase.property.node " >node</a ></code > | <code >constructs.Node</code > | The tree node. |
729765| <code ><a href =" #eoapi-cdk.PgStacDatabase.property.connectionTarget " >connectionTarget</a ></code > | <code >aws-cdk-lib.aws_ec2.Instance \| aws-cdk-lib.aws_rds.IDatabaseInstance</code > | * No description.* |
730766| <code ><a href =" #eoapi-cdk.PgStacDatabase.property.pgstacVersion " >pgstacVersion</a ></code > | <code >string</code > | * No description.* |
767+ | <code ><a href =" #eoapi-cdk.PgStacDatabase.property.pgbouncerHealthCheck " >pgbouncerHealthCheck</a ></code > | <code >aws-cdk-lib.CustomResource</code > | * No description.* |
731768| <code ><a href =" #eoapi-cdk.PgStacDatabase.property.secretBootstrapper " >secretBootstrapper</a ></code > | <code >aws-cdk-lib.CustomResource</code > | * No description.* |
732769| <code ><a href =" #eoapi-cdk.PgStacDatabase.property.securityGroup " >securityGroup</a ></code > | <code >aws-cdk-lib.aws_ec2.SecurityGroup</code > | * No description.* |
733770| <code ><a href =" #eoapi-cdk.PgStacDatabase.property.db " >db</a ></code > | <code >aws-cdk-lib.aws_rds.DatabaseInstance</code > | * No description.* |
@@ -767,6 +804,16 @@ public readonly pgstacVersion: string;
767804
768805---
769806
807+ ##### ` pgbouncerHealthCheck ` <sup >Optional</sup > <a name =" pgbouncerHealthCheck " id =" eoapi-cdk.PgStacDatabase.property.pgbouncerHealthCheck " ></a >
808+
809+ ``` typescript
810+ public readonly pgbouncerHealthCheck : CustomResource ;
811+ ```
812+
813+ - * Type:* aws-cdk-lib.CustomResource
814+
815+ ---
816+
770817##### ` secretBootstrapper ` <sup >Optional</sup > <a name =" secretBootstrapper " id =" eoapi-cdk.PgStacDatabase.property.secretBootstrapper " ></a >
771818
772819``` typescript
0 commit comments