@@ -71,11 +71,23 @@ export interface AuroraClusterProps {
7171 readonly removalPolicy ?: cdk . RemovalPolicy ;
7272
7373 /**
74- * The parameters to override in the parameter group .
74+ * The parameters to override in all of the parameter groups .
7575 * @default - No parameter is overridden.
7676 */
7777 readonly parameters ?: Record < string , string > ;
7878
79+ /**
80+ * The parameters to override in the cluster parameter group.
81+ * @default - No parameter is overridden.
82+ */
83+ readonly clusterParameters ?: Record < string , string > ;
84+
85+ /**
86+ * The parameters to override in the instance parameter group.
87+ * @default - No parameter is overridden.
88+ */
89+ readonly instanceParameters ?: Record < string , string > ;
90+
7991 /**
8092 * The list of log types that need to be enabled for exporting to CloudWatch Logs.
8193 * @default - No log types are enabled.
@@ -122,19 +134,40 @@ export class AuroraCluster extends Construct implements IDatabase {
122134 readonly resource : rds . DatabaseCluster ;
123135
124136 readonly endpoint : rds . Endpoint ;
137+ /**
138+ * @deprecated please use instanceParameterGroup.
139+ */
125140 readonly parameterGroup : rds . ParameterGroup ;
141+ readonly clusterParameterGroup : rds . ParameterGroup ;
142+ readonly instanceParameterGroup : rds . ParameterGroup ;
126143
127144 constructor ( scope : Construct , id : string , props : AuroraClusterProps ) {
128145 super ( scope , id ) ;
129146
130147 const removalPolicy = props . removalPolicy ?? cdk . RemovalPolicy . RETAIN ;
131- this . parameterGroup = new rds . ParameterGroup ( this , 'ParameterGroup' , {
148+ this . instanceParameterGroup = new rds . ParameterGroup ( this , 'ParameterGroup' , {
149+ engine : props . engine ,
150+ description : this . node . path ,
151+ removalPolicy : [ cdk . RemovalPolicy . DESTROY , cdk . RemovalPolicy . RETAIN ] . includes ( removalPolicy )
152+ ? removalPolicy
153+ : cdk . RemovalPolicy . DESTROY ,
154+ parameters : {
155+ ...props . parameters ,
156+ ...props . instanceParameters ,
157+ } ,
158+ } ) ;
159+ this . parameterGroup = this . instanceParameterGroup ;
160+
161+ this . clusterParameterGroup = new rds . ParameterGroup ( this , 'ClusterParameterGroup' , {
132162 engine : props . engine ,
133163 description : this . node . path ,
134164 removalPolicy : [ cdk . RemovalPolicy . DESTROY , cdk . RemovalPolicy . RETAIN ] . includes ( removalPolicy )
135165 ? removalPolicy
136166 : cdk . RemovalPolicy . DESTROY ,
137- parameters : props . parameters ,
167+ parameters : {
168+ ...props . parameters ,
169+ ...props . clusterParameters ,
170+ } ,
138171 } ) ;
139172
140173 const backup = props . backupRetention ? { retention : props . backupRetention } : undefined ;
@@ -171,7 +204,7 @@ export class AuroraCluster extends Construct implements IDatabase {
171204 vpc : props . networking . vpc ,
172205 vpcSubnets : props . networking . isolatedSubnets ,
173206 defaultDatabaseName : props . databaseName ,
174- parameterGroup : this . parameterGroup ,
207+ parameterGroup : this . clusterParameterGroup ,
175208 storageEncrypted : true ,
176209 securityGroups : [ securityGroup ] ,
177210 cloudwatchLogsExports : props . cloudwatchLogsExports ,
0 commit comments