How to upgrade Aurora serverless MySQL cluster from 5.6 to 5.7 when using CloudFormation

Viewed 1874

I have Aurora serverless MySQL cluster running engine version 5.6. It is set up using CloudFormation.

What is the best way to upgrade the cluster to support MySQL 5.7?

I tried changing EngineVersion from 5.6 to 5.7, and engine from aurora to aurora-mysql as well as specifying new parameter group for 5.7.

Updating the stack with these changes returns an error:

In-place upgrade of the engine to a new major version isn't supported on serverless engine mode. (Service: AmazonRDS; Status Code: 400; Error Code: InvalidDBClusterStateFault;

I don't trust this error as this shouldn't be a major version and what documentation I can find supports the idea that this should be possible.

Below is the CloudFormation code snippet, excluding irrelevant properties:

  RDSDBClusterParameterGroup:
    Type: 'AWS::RDS::DBClusterParameterGroup'
    Properties:
      Description: Aurora Cluster Parameter Group for aurora-mysql5.7
      Family: aurora-mysql5.7
      Parameters:
        general_log: '0'
  RDSCluster:
    Type: 'AWS::RDS::DBCluster'
    DependsOn: 
      - RDSDBClusterParameterGroup
    Properties:   
      DBClusterParameterGroupName: 
        Ref: RDSDBClusterParameterGroup
      Engine: aurora-mysql
      EngineMode: serverless
      EngineVersion: 5.7
      [..]
2 Answers

I wasn't able to perform an upgrade. It counts as a major version since we are upgrading from Aurora serverless V1 to V2.

Was a bit complicated to find the best solution since I had to use CFN.

Resolved it like this:

  1. using console created snapshot from existing 5.6 cluster
  2. restored snapshot to a new 5.7 supported cluster (Aurora serverless v2)
  3. imported the new cluster resource in the existing CFN stack
  4. updated the template in my pipeline and run deployment again(no changes since it is already imported)
  5. verified everything works in the new cluster and all data is present.
  6. deleted the old v1 (5.6) cluster from the template and stack.

It is now possible to do in-place upgrades as described in https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Updates.MajorVersionUpgrade.html#AuroraMySQL.Updates.MajorVersionUpgrade.1to2

I was able to upgrade using CloudFormation by changing:

  • DBCluster > Engine to 'aurora-mysql'
  • DBCluster > EngineVersion to '5.7.mysql_aurora.2.07.1'
  • DBClusterParameterGroup > Family to 'aurora-mysql5.7'
  • Because a DBClusterParameterGroup already existed I had to change the logicalID and chose DBClusterParameterGroup57

Using your example:

RDSDBClusterParameterGroup57:
  Type: 'AWS::RDS::DBClusterParameterGroup'
  Properties:
     Description: Aurora Cluster Parameter Group for aurora-mysql5.7
     Family: aurora-mysql5.7
     Parameters:
         general_log: '0'
RDSCluster:
    Type: 'AWS::RDS::DBCluster'
    DependsOn: 
        - DBClusterParameterGroup57
    Properties:   
       DBClusterParameterGroupName: 
           Ref: RDSDBClusterParameterGroup
       Engine: aurora-mysql
       EngineMode: serverless
       EngineVersion: '5.7.mysql_aurora.2.07.1'
       [..]
Related