MySQL, Scheduled Events and Amazon RDS

This article explains how to enable SQL database scheduled events for the Amazon Relational Database Service (RDS). By default, Amazon does not allow one to create (in other words, to schedule) events. Events are SQL code intended to execute periodically or in future. The solution is quite similar my last article. One needs to provide the ‘event_scheduler’ parameter set to “ON” or “1”. Parameters are set by creating a new parameter group (or editing an existing one) and assigning this parameter group to the database instance.

  1. Open the RDS web console.
  2. Open the “Parameter Groups” tab.
  3. If necessary, create a new Parameter Group. On the dialog, select the MySQL family compatible to your MySQL database version, give it a name and confirm.
  4. Select the just created Parameter Group and issue “Edit Parameters”.
  5. Look for the parameter ‘event_scheduler’ and set its value to “ON” or “1”.
  6. Save the changes.
  7. Open the “Instances” tab. Expand your MySQL instance and issue the “Instance Action” named “Modify”.
  8. If you have not yet assigned the Parameter Group to your database instance, select the Parameter Group and enable “Apply Immediately”.
  9. Click on “Continue” and confirm the changes.
  10. Dont forget: Again, open the “Instances” tab. Expand your MySQL instance and issue the “Instance Action” named “Reboot”.

3 Responses to MySQL, Scheduled Events and Amazon RDS

  1. Pingback: RDS Parameter Group Setting issues | Rachel's Blog

  2. mbourgon says:

    Thanks for the article. Still relevant! One question: how do you monitor the events? Say it fails (we’re setting up partitioning). Where are the alerts and how do I get them to cloudwatch?
    Thanks!

  3. mbourgon says:

    Answering my own question, found this post on Stackoverflow (https://dba.stackexchange.com/questions/89818/how-to-get-something-written-to-mysql-error-log-without-restart) which uses this syntax:
    CREATE EVENT test_error_log ON SCHEDULE AT NOW() ON COMPLETION NOT PRESERVE
    DO SIGNAL SQLSTATE ‘45000’ SET MESSAGE_TEXT = ‘hi from the error log’;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: