Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RDS: cannot major-version upgrade Aurora cluster with custom instance parameter group #26072

Open
mjgp2 opened this issue Jun 21, 2023 · 3 comments
Labels
@aws-cdk/aws-rds Related to Amazon Relational Database bug This issue is a bug. effort/small Small work item – less than a day of effort p2

Comments

@mjgp2
Copy link

mjgp2 commented Jun 21, 2023

Describe the bug

In order to do an in-place major version upgrade of Aurora, you need to set dbInstanceParameterGroupName on the cluster, not just on the individual instances. You cannot do this today.

Expected Behavior

Aurora cluster would do a major version upgrade

Current Behavior

On trying to upgrade the cluster:

Error: The stack named XXXX failed to deploy: UPDATE_ROLLBACK_COMPLETE: Resource handler returned message: "The current DB instance parameter group XXXXX is custom. You must explicitly specify a new DB instance parameter group, either default or custom, for the engine version upgrade.

Reproduction Steps

new DatabaseCluster(this, id, {
    ...
      instanceProps: {
        parameterGroup: ParameterGroup.fromParameterGroupName(this, `instance-parameter-group-15`, `${this.databaseName}-aurora15-custom-instance-parameter-group`),
      },
      parameterGroup: ParameterGroup.fromParameterGroupName(this, `cluster-parameter-group-15`, `${this.databaseName}-aurora15-custom-cluster-parameter-group`),
    });

Possible Solution

Workaround:

    const cluster: CfnDBCluster = this.cluster.node.children.filter(x => x instanceof CfnDBCluster)[0] as CfnDBCluster;
    cluster.dbInstanceParameterGroupName = `${this.databaseName}-aurora15-custom-instance-parameter-group`;

Additional Information/Context

No response

CDK CLI Version

2.61.1

Framework Version

No response

Node.js Version

20.1.0

OS

macos

Language

Typescript

Language Version

No response

Other information

No response

@mjgp2 mjgp2 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jun 21, 2023
@github-actions github-actions bot added the @aws-cdk/aws-rds Related to Amazon Relational Database label Jun 21, 2023
@peterwoodworth
Copy link
Contributor

Whatever you pass in for the name in fromParameterGroupName should be getting set as the cluster.dbInstanceParameterGroupName, so I'm not sure why the escape hatch is necessary. Could you illustrate the difference in your synthesized template both with and without the escape hatch?

@peterwoodworth peterwoodworth added p2 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. labels Jun 21, 2023
@mjgp2
Copy link
Author

mjgp2 commented Jun 22, 2023

Sure.

With:

{
   "Type": "AWS::RDS::DBCluster",
   "Properties": {
    "DatabaseName": "xxx",
    "DBClusterIdentifier": "xxx-integration",
    "DBClusterParameterGroupName": "xxx-aurora15-custom-cluster-parameter-group",
    "DBInstanceParameterGroupName": "xxx-aurora15-custom-instance-parameter-group",
    "DBSubnetGroupName": {
     "Ref": "xxxdatabaseSubnets48D94137"
    },
    ...
   },
   ...
}

Without:

{
   "Type": "AWS::RDS::DBCluster",
   "Properties": {
    "DatabaseName": "xxx",
    "DBClusterIdentifier": "xxx-integration",
    "DBClusterParameterGroupName": "xxx-aurora15-custom-cluster-parameter-group",
    "DBSubnetGroupName": {
     "Ref": "xxxdatabaseSubnets48D94137"
    },
    ...
   },
   ...

Note the instance with or without the hatch has the correct group name:

{
   "Type": "AWS::RDS::DBInstance",
   "Properties": {
    "AutoMinorVersionUpgrade": false,
    "DBClusterIdentifier": {
     "Ref": "xxxdatabase01057C8A"
    },
    "DBInstanceClass": "db.t4g.medium",
    "DBInstanceIdentifier": "xxx-integrationinstance1",
    "DBParameterGroupName": "xxx-aurora15-custom-instance-parameter-group",
    "DBSubnetGroupName": {
     "Ref": "xxxdatabaseSubnets48D94137"
    },
    "EnablePerformanceInsights": true,
    "Engine": "aurora-postgresql",
    ...
  },

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jun 22, 2023
@caveman-dick
Copy link

I have just come across this issue too. I managed to fix using a slightly simpler escape-hatch:

const cfnGreenCluster = greenCluster.node.defaultChild as rds.CfnDBCluster;
cfnGreenCluster.dbInstanceParameterGroupName = "my-custom-pg";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-rds Related to Amazon Relational Database bug This issue is a bug. effort/small Small work item – less than a day of effort p2
Projects
None yet
Development

No branches or pull requests

3 participants