Aws-cdk: Creating Aurora Cluster with Postgresql fails

Created on 20 Nov 2019  路  7Comments  路  Source: aws/aws-cdk

I expected that by just changing engine and engineVersion I would get a Postgresql Cluster.

Reproduction Steps

Running CDK with db-stack that contains:

    this.cluster = new DatabaseCluster(this, 'ProductDatabase', {
      defaultDatabaseName: 'ProductDb',
      engine: DatabaseClusterEngine.AURORA_POSTGRESQL,
      engineVersion: '11.4',
      masterUser: {
        username: 'clusteradmin',
      },
      instanceProps: {
        instanceType: InstanceType.of(InstanceClass.BURSTABLE2, InstanceSize.SMALL),
        vpcSubnets: {
          subnetType: SubnetType.ISOLATED,
        },
        vpc: props.vpc,
      },
    })

fails with:

The Parameter Group default.aurora5.6 with DBParameterGroupFamily aurora5.6 cannot be used for this instance. Please use a Parameter Group with DBParameterGroupFamily aurora-postgresql11 (Service: AmazonRDS; Status Code: 400; Error Code: InvalidParameterCombination; Request ID: 4ced8114-0f04-4659-9cde-c214db8638fa)

Clearly it's not supposed to pick aurora5.6 group family with postgresql11 but I have no idea what I'm doing wrong so I expect this to be a bug.

Error Log

  6/14 | 10:02:08 AM | CREATE_FAILED        | AWS::RDS::DBCluster                         | ProductDatabase (ProductDatabase9844B02C) The Parameter Group default.aurora5.6 with DBParameterGroupFamily aurora5.6 cannot be used for this instance. Please use a Parameter Group with DBParameterGroupFamily aurora-postgresql11 (Service: AmazonRDS; Status Code: 400; Error Code: InvalidParameterCombination; Request ID: 4ced8114-0f04-4659-9cde-c214db8638fa)
    new DatabaseCluster (/home/vertti/dev/kesko/k-ruoka-product-service/node_modules/@aws-cdk/aws-rds/lib/cluster.ts:315:21)
    \_ new ProductDbStack (/home/vertti/dev/kesko/k-ruoka-product-service/lib/db-stack.ts:17:20)
    \_ Object.<anonymous> (/home/vertti/dev/kesko/k-ruoka-product-service/bin/product-service.ts:11:17)
    \_ Module._compile (internal/modules/cjs/loader.js:778:30)
    \_ Module.m._compile (/home/vertti/dev/kesko/k-ruoka-product-service/node_modules/ts-node/src/index.ts:530:23)
    \_ Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    \_ Object.require.extensions.(anonymous function) [as .ts] (/home/vertti/dev/kesko/k-ruoka-product-service/node_modules/ts-node/src/index.ts:533:12)
    \_ Module.load (internal/modules/cjs/loader.js:653:32)
    \_ tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    \_ Function.Module._load (internal/modules/cjs/loader.js:585:3)
    \_ Function.Module.runMain (internal/modules/cjs/loader.js:831:12)

Environment

  • CLI Version : 1.5.0
  • Framework Version: 1.5.0
  • OS : Ubuntu
  • Language : Typescript

This is :bug: Bug Report

@aws-cdaws-rds efformedium feature-request in-progress

Most helpful comment

fyi: I'm having the same issue + also the port is 3306 instead of 5432 when choosing DatabaseClusterEngine.AURORA_POSTGRESQL and adding the mentioned parameterGroup.

All 7 comments

Adding the folllowing to the cluster definition:

 parameterGroup: ParameterGroup.fromParameterGroupName(this, 'ParameterGroup', 'default.aurora-postgresql11'),

gets you past the error message above. This should really by described in the documentation!

But after adding that I get a new error message:

RDS does not support creating a DB instance with the following combination: DBInstanceClass=db.t2.small, Engine=aurora-postgresql, EngineVersion=11.4, LicenseModel=postgresql-license. For supported combinations of instance class and database engine version, see the documentation. (Service: AmazonRDS; Status Code: 400; Error Code: InvalidParameterCombination; Request ID: dfb07895-5687-486e-a39e-49b0e59a170f)

From what I can find from AWS documentation, 11.4 is supported and db.t2.small is allowed for all Postgreqsql versions.

Finally found the correct table: according to this, Aurora Postgresql supports only t3.medium instances.

So I would add to the documentation:

  • explanation on using the ParameterGroup for creating Postgresql
  • link to the above tables to see what the instance types should be

Thanks for reporting @vertti .

@jogold I wonder whether we can improve the DatabaseCluster (EDIT: actually, more DatabaseClusterEngine) construct, so that if parameterGroup was not specified, we will default it based on the engine that was passed - in this example, for instance, we see that the engine is AURORA_POSTGRESQL, and default the parameter group name to default.aurora-postgresql11. We can add a method to the DatabaseClusterEngine class to do that.

Thoughts?

@skinny85 related https://github.com/aws/aws-cdk/issues/2213 and https://github.com/aws/aws-cdk/issues/2512

The CFN doc: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-dbclusterparametergroupname

If this argument is omitted, default.aurora5.6 is used. If default.aurora5.6 is used, specifying aurora-mysql or aurora-postgresql for the Engine property might result in an error.

So the right approach seems to be default.<engine><version> but version is optional, do you want to hard code default versions?

So the right approach seems to be default. but version is optional, do you want to hard code default versions?

Yep. I think hard-coding is better in this case than failing at CFN deployment time.

I flagged the wrong issues in #5721 , please ignore 馃檪

fyi: I'm having the same issue + also the port is 3306 instead of 5432 when choosing DatabaseClusterEngine.AURORA_POSTGRESQL and adding the mentioned parameterGroup.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ababra picture ababra  路  3Comments

schof picture schof  路  3Comments

eladb picture eladb  路  3Comments

artyom-melnikov picture artyom-melnikov  路  3Comments

peterdeme picture peterdeme  路  3Comments