diff --git a/lib/constructs/database.ts b/lib/constructs/database.ts index e97abfc..f798063 100644 --- a/lib/constructs/database.ts +++ b/lib/constructs/database.ts @@ -37,13 +37,15 @@ export class Database extends Construct implements ec2.IConnectable { enableDataApi: true, storageEncrypted: true, removalPolicy: RemovalPolicy.DESTROY, - parameterGroup: new rds.ParameterGroup(this, 'ParameterGroup', { - engine, - parameters: { - // Terminate idle session for Aurora Serverless V2 auto-pause - idle_session_timeout: '60000', - }, - }), + parameterGroup: auroraScalesToZero + ? // Terminate idle session for Aurora Serverless V2 auto-pause + new rds.ParameterGroup(this, 'ParameterGroup', { + engine, + parameters: { + idle_session_timeout: '60000', + }, + }) + : undefined, }); this.connections = cluster.connections; diff --git a/test/__snapshots__/langfuse-with-aws-cdk-prod.test.ts.snap b/test/__snapshots__/langfuse-with-aws-cdk-prod.test.ts.snap index 54337af..94b2e4d 100644 --- a/test/__snapshots__/langfuse-with-aws-cdk-prod.test.ts.snap +++ b/test/__snapshots__/langfuse-with-aws-cdk-prod.test.ts.snap @@ -1574,9 +1574,7 @@ exports[`snapshot test for prod 1`] = ` "DeletionPolicy": "Delete", "Properties": { "CopyTagsToSnapshot": true, - "DBClusterParameterGroupName": { - "Ref": "DatabaseParameterGroup2A921026", - }, + "DBClusterParameterGroupName": "default.aurora-postgresql16", "DBSubnetGroupName": { "Ref": "DatabaseClusterSubnets5540150D", }, @@ -1775,16 +1773,6 @@ exports[`snapshot test for prod 1`] = ` "Type": "AWS::RDS::DBInstance", "UpdateReplacePolicy": "Delete", }, - "DatabaseParameterGroup2A921026": { - "Properties": { - "Description": "Cluster parameter group for aurora-postgresql16", - "Family": "aurora-postgresql16", - "Parameters": { - "idle_session_timeout": "60000", - }, - }, - "Type": "AWS::RDS::DBClusterParameterGroup", - }, "LoadBalancerAlbAccessLogBucket57C7E043": { "DeletionPolicy": "Delete", "Properties": {