Direct naar hoofdinhoud

Why the MySQL event scheduler doesn’t work on Aurora Serverless (and how to fix it with AWS Lambda)

Sql 768X480
Filter: blogs
Filter: tech
delen

Where the MySQL Event Scheduler mechanism works for both the MySQL  and  Aurora Cluster RDS services. It seemed not to work after migrating our applications to Aurora Serverless clusters.

The event_scheduler parameter was still set in the parameter group:

 DBClusterParameterGroup:
    Type: AWS::RDS::DBClusterParameterGroup
    Properties:
      Description: !Sub 'terra10-${ENV}-parametergroup'
      Family: aurora5.6
      Parameters:
        event_scheduler: 'ON'
      Tags:
        - Key: Name
          Value: !Sub 'terra10-${ENV}-parametergroup'

But the database did not seem to pick up the setting:

SELECT @@global.event_scheduler;
"OFF"

Then we noticed this post which told us we are not alone. It seems a limitation when using the Aurora Serverless  MySQL engine, however not well documented.

 

 

Luckily we had a AWS Lambda stack in place using the Serverless framework, so decided to move the current MySQL events to scheduled Lambda functions. With the help of the Serverless Schedule(Verwijst naar een externe website) event this was incredible easy:

functions:
  aggregate:
    handler: aggregate.handler
    events:
      - schedule: rate(4 hours)
Jan van Zoggel
Jan van Zoggel

meer blogs in Blogs en Tech