Skip to content

Cannot create an aurora serverlessv2 cluster as a PITR copy-on-write clone with a custom parameter group using cloudformation.

0

I trying to use CloudFormation to create a PITR clone of a shared aurora serverless v2 database using SourceDBClusterIdentifier. This works via the cli api, but not via cloudformation, and I cannot determine why. The error is that "The cluster parameter group name is required when the source cluster uses a custom parameter group." but my CloudFormation template does specify a "DBClusterParameterGroupName" and I've verified that it exists in the account by that name. When I look in cloudtrail, the invocation of RestoreDBClusterToPointInTime sent by cloudfront does not contain the parameter group name that was specified in the template.

The template is:




"Resources": {
    "<elided>": {
      "Type": "AWS::RDS::DBCluster",
      "Properties": {
        "BacktrackWindow": 0,
        "DBClusterIdentifier": "aClusterId",
        "DBClusterParameterGroupName": "the-parameter-group-name",
        "DBSubnetGroupName": "db-private-subnet-group",
        "DeletionProtection": false,
        "EnableIAMDatabaseAuthentication": true,
        "Engine": "aurora-mysql",
        "EngineVersion": "8.0.mysql_aurora.3.05.2",
        "KmsKeyId": "<elided>",
        "RestoreType": "copy-on-write",
        "ServerlessV2ScalingConfiguration": {
          "MaxCapacity": 48,
          "MinCapacity": 0.5
        },
        "SourceDBClusterIdentifier": <the-source-arn>",
        "UseLatestRestorableTime": true,
        "VpcSecurityGroupIds": [
          "sg-<elided>"
        ]
      },
      "UpdateReplacePolicy": "Delete",
      "DeletionPolicy": "Delete"
    },

1 Answer
0

The issue you're experiencing is related to how CloudFormation handles parameter groups when creating a point-in-time recovery (PITR) clone of an Aurora Serverless v2 cluster.

When you're creating a PITR clone of an Aurora cluster that uses a custom parameter group, CloudFormation needs to properly pass the DBClusterParameterGroupName parameter to the RestoreDBClusterToPointInTime API call. However, it appears that CloudFormation isn't correctly including this parameter in the API call, as evidenced by your CloudTrail logs.

This is likely a limitation or bug in the CloudFormation service's handling of the AWS::RDS::DBCluster resource type when used with RestoreType: "copy-on-write" and SourceDBClusterIdentifier.

As a workaround, you have a few options:

  1. Continue using the AWS CLI or API directly to create your PITR clones, since you've confirmed this works.

  2. Create a custom resource in your CloudFormation template that uses Lambda to call the RestoreDBClusterToPointInTime API directly, giving you more control over the parameters passed.

  3. Split your deployment into two steps:

  • First, create the PITR clone without specifying the parameter group
  • Then, update the cluster to use your custom parameter group

For Aurora Serverless v2, it's important to note that both DB cluster parameter groups and DB parameter groups are used. The DB cluster parameter group applies to all DB instances in a cluster, while individual DB parameter groups can override these settings at the instance level. When you modify values in the DB cluster parameter group, they override default values in the DB parameter group, but if you edit the corresponding values in the DB parameter group, those values will override the settings from the DB cluster parameter group.

Make sure that your custom parameter group is properly configured for Aurora Serverless v2 and that it exists in the same AWS account and region where you're deploying your CloudFormation template.
Sources
DB cluster parameter groups for Amazon Aurora DB clusters - Amazon Aurora

answered a year ago

  • For the workarounds, (1) yes, obviously I could give up, (2) that's not an advantage over (1) because I still have custom code, it's just in a lambda, and (3) won't work because THAT'S WHAT'S HAPPENING NOW, it's trying to create the PITR cluster without the parameter group.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.