Error: DBClusterInstanceClass isn't supported for DB engine aurora-mysql | Cloudformation

0

Hello Team,

I have created a CloudFormation template for aurora-mysql8.0. But while running the template I am getting error: DBClusterInstanceClass isn't supported for DB engine aurora-mysql. I am not sure if I need to remove this option from the template as I wont be able to to set the DBClusterInstance type then.

The template is as below:

Parameters:
  DatabaseName:
    Default: MyDatabase
    Description: The database name
    Type: String
    MinLength: '1'
    MaxLength: '64'
    AllowedPattern: '[a-zA-Z][a-zA-Z0-9]*'
    ConstraintDescription: must begin with a letter and contain only alphanumeric
      characters.
  DBUser:
    NoEcho: 'false'
    Description: The database admin account username
    Type: String
    MinLength: '1'
    MaxLength: '16'
  DBPassword:
    NoEcho: 'true'
    Description: The database admin account password
    Type: String
    MinLength: '8'
    MaxLength: '41'
  DBClusterInstanceClass: 
    Description: Instance class for RDS
    Type: String
    MinLength: '1'
    MaxLength: '16'
  AllocatedStorage:
    Description: Required storage
    Type: Number
  Engine:
    Description: DB Engine
    Type: String
    Default: aurora-mysql
    MinLength: '1'
    MaxLength: '16'
  EngineVersion:
    Description: RDS version
    Type: String
    Default: 8.0.mysql_aurora.3.02.1
  BackupRetentionPeriod:
    Description: RDS retention period
    Type: String
  DBClusterIdentifier:
    Description: DB identifier
    Type: String
  BackupRetentionPeriod:
    Description: RDS retention period
    Type: String
  EnablePerformanceInsights:
    Description: Enable or Disable performance insight
    Type: String
  PreferredBackupWindow:
    Description: Backup window
    Type: String
  PreferredMaintenanceWindow:
    Description: Maintainence window
    Type: String
  VpcSecurityGroupIds:
    Description: SG for RDS
    Type: String
  SubnetID1:
    Description: Subnets for the RDS in subnet group
    Type: String
  SubnetID2:
    Description: Subnets for the RDS in subnet group
    Type: String
  MonitoringRoleArn:
    Description: RDS Monitoring Role
    Type: String
Resources:
  MyDB:
    Type: AWS::RDS::DBCluster
    Properties:
      DatabaseName: !Ref 'DatabaseName'
      AllocatedStorage: !Ref 'AllocatedStorage'
      DBClusterInstanceClass: !Ref 'DBClusterInstanceClass'
      Engine: !Ref 'Engine'
      EngineVersion: !Ref 'EngineVersion'
      BackupRetentionPeriod: !Ref 'BackupRetentionPeriod'
      DBClusterIdentifier: !Ref 'DBClusterIdentifier'
      DBSubnetGroupName: !Ref 'MYSubnetGroup'
      EnableCloudwatchLogsExports: 
         - audit
         - error
      PerformanceInsightsEnabled: !Ref 'EnablePerformanceInsights'
      PreferredBackupWindow: !Ref 'PreferredBackupWindow'
      PreferredMaintenanceWindow: !Ref 'PreferredMaintenanceWindow'
      PubliclyAccessible: False
      StorageEncrypted: True
      StorageType: gp2
      MonitoringInterval: 60
      MonitoringRoleArn: !Ref 'MonitoringRoleArn'
      VpcSecurityGroupIds: 
        - !Ref 'VpcSecurityGroupIds'
      MasterUsername: !Ref 'DBUser'
      MasterUserPassword: !Ref 'DBPassword'
      DBClusterParameterGroupName: !Ref 'ClusterParameterGroup'
      DeletionProtection: True
      AutoMinorVersionUpgrade: True
      CopyTagsToSnapshot: True
  ClusterParameterGroup:
    Type: 'AWS::RDS::DBClusterParameterGroup'
    Properties:
      Description: Cluster Parameter group for RDS
      Family: aurora-mysql8.0
      Parameters:
        require_secure_transport: 'ON'
        server_audit_logging: '1'
  MYSubnetGroup:
    Type: AWS::RDS::DBSubnetGroup
    Properties: 
      DBSubnetGroupDescription: subnet group for the rds
      SubnetIds: 
        - !Ref 'SubnetID1'
        - !Ref 'SubnetID2'
3 Answers
2
Accepted Answer

For DB engine aurora-mysql, you should use a combination of CloudFormation resource types AWS::RDS::DBCluster and AWS::RDS::DBInstance. Then, you specify the instance type via DBInstanceClass property of AWS::RDS::DBInstance.

The AWS CloudFormation documentation has some examples on creating an Aurora DB: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-dbclusterinstanceclass. It's using aurora-postgresql, but you can use it as reference when creating your aurora-mysql.

profile picture
joahna
answered a year ago
  • Thanks Joahna! This worked.

1

Hi! You can use the below command to determine db instance classes supported in a region based on engine and engine-version. aws rds describe-orderable-db-instance-options --engine aurora-mysql --engine-version 8.0.mysql_aurora.3.02.1 --query "OrderableDBInstanceOptions[].{DBInstanceClass:DBInstanceClass,SupportedEngineModes:SupportedEngineModes[0]}" --output table

profile picture
answered a year ago
  • Thanks Rares. I tried that but it gave the same error. However later I found that we need to use io1 storage type instead of gp2 for multiaz and we need to add iops parameter as well.

    StorageType Specifies the storage type to be associated with the DB cluster.

    This setting is required to create a Multi-AZ DB cluster.

    Valid values: io1

    When specified, a value for the Iops parameter is required.

    Default: io1

    Valid for: Multi-AZ DB clusters only

    Required: No

    Type: String

    Update requires: No interruption

    But while doing so it gave me another error:

    error: "Iops isn't supported for DB engine aurora-mysql.

    And when I am removing the iops parameter from the template, I back to the old error:

    error: DBClusterInstanceClass isn't supported for DB engine aurora-mysql

1

Thank you for your question.

StorageType only apply for RDS, and RDS Multi-AZ cluster(not Aurora).

To create Aurora cluster, and instances, please use two separate section like below code snippet. This is minimum snippet, and reference purpose only. So please add necessary section, and settings as you want.

Resources:
  DBCluster:
    Type: AWS::RDS::DBCluster
    DeletionPolicy: Snapshot
    Properties:
      Engine: aurora-mysql
      EngineVersion: 8.0.mysql_aurora.3.02.1

  DBInstance1:
    Type: AWS::RDS::DBInstance
    Properties:
      Engine: aurora-mysql
      DBClusterIdentifier: !Ref "DBCluster"
      DBInstanceClass: !Ref "DBClusterInstanceClass"
      DBSubnetGroupName: !Ref "DBSubnetGroup"
      DBParameterGroupName: !Ref "DBParameterGroup"

I hope this might help.

AWS
answered a year ago
  • Template format error: Unresolved resource dependencies [DBClusterInstanceClass] in the Resources block of the template getting this error from the cloud template following is the my Yaml code

    AuroraDBCluster: Type: AWS::RDS::DBCluster Properties: Engine: aurora-mysql EngineVersion: 8.0.mysql_aurora.3.02.1 MasterUsername: admin MasterUserPassword: DBClusterIdentifier: database-1 DBSubnetGroupName: !Ref AuroraSubnetGroup VpcSecurityGroupIds: - !Ref DatabaseSecurityGroup

    AuroraDBInstance: Type: AWS::RDS::DBInstance Properties: DBClusterIdentifier: !Ref AuroraDBCluster Engine: aurora-mysql DBInstanceClass: !Ref "DBClusterInstanceClass" AvailabilityZone: ap-south-1c # You can specify any AZ here DBSubnetGroupName: !Ref AuroraSubnetGroup PubliclyAccessible: false VPCSecurityGroups: - !Ref DatabaseSecurityGroup

    what is the solution for me?

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.

Guidelines for Answering Questions