Amazon RDS events
An Amazon
RDS event indicates a change in the Amazon RDS environment. For example, when
the DB instance status changes from Starting to
Available, Amazon RDS generates the event RDS-EVENT-0088 The DB
instance has been started
. Amazon RDS delivers events to Amazon EventBridge in near real time. You
can access events though the Amazon RDS console, the AWS CLI command describe-events
![Alarms, events, and logs displayed on the Amazon RDS console](/images/prescriptive-guidance/latest/amazon-rds-monitoring-alerting/images/alarms-events-logs-rds-console.png)
Amazon RDS emits different types of events, including DB instance events, DB parameter group events, DB security group events, DB snapshot events, RDS Proxy events, and blue/green deployment events. The information includes:
-
Source name and source type; for example:
"SourceIdentifier": "database-1", "SourceType": "db-instance"
-
Date and time of the event; for example:
"Date": "2022-12-01T09:20:28.595000+00:00"
-
Message associated with the event; for example:
"Message": "Finished updating DB parameter group"
-
Event category; for example:
"EventCategories": ["configuration change"]
For a complete reference, see Amazon RDS event categories and event messages in the Amazon RDS documentation.
We recommend that you monitor Amazon RDS events, because these events indicate status changes
in the availability of DB instances, configuration changes, read replica status changes,
backup and recovery events, failover actions, failure events, modifications to security
groups, and many other notifications. For example, if you have set up a read replica DB
instance to provide enhanced performance and durability for your database, we recommend that
you monitor Amazon RDS events for the read replica event category associated
with DB instances. This is because events such as RDS-EVENT-0057 Replication on the read
replica was terminated
indicate that your read replica is no longer synchronizing
with the primary DB instance. A notification to the responsible team that such an event has
happened could help timely mitigation of the issue. Amazon EventBridge and additional AWS services, such
as AWS Lambda, Amazon Simple Queue Service (Amazon SQS), and Amazon Simple Notification Service (Amazon SNS), can help you automate responses to
system events such as database availability issues or resource changes.
On the Amazon RDS console, you can retrieve events from the past 24 hours. If you use the AWS CLI or the Amazon RDS API to view events, you can retrieve events from the past 14 days by using the describe-events command as follows.
$ aws rds describe-events --source-identifier database-1 --source-type db-instance { "Events": [ { "SourceIdentifier": "database-1", "SourceType": "db-instance", "Message": "CloudWatch Logs Export enabled for logs [audit, error, general, slowquery]", "EventCategories": [], "Date": "2022-12-01T09:20:28.595000+00:00", "SourceArn": "arn:aws:rds:eu-west-3:111122223333:db:database-1" }, { "SourceIdentifier": "database-1", "SourceType": "db-instance", "Message": "Finished updating DB parameter group", "EventCategories": [ "configuration change" ], "Date": "2022-12-01T09:22:40.413000+00:00", "SourceArn": "arn:aws:rds:eu-west-3:111122223333:db:database-1" } ] }
If you want to store events for the long term, either until the specified expiration period or permanently, you can use CloudWatch Logs to log the information about the events that were generated by Amazon RDS. To implement this solution, you can use an Amazon SNS topic to receive Amazon RDS event notifications and then call a Lambda function to log the event in CloudWatch Logs.
-
Create a Lambda function that will be called on the event and log the information from the event to CloudWatch Logs. CloudWatch Logs is integrated with Lambda and provides a convenient way to log event information, by using the print function to
stdout
. -
Create an SNS topic with a subscription to a Lambda function (set Protocol to Lambda), and set the Endpoint to the Amazon Resource Name (ARN) of the Lambda function that you created in the previous step.
-
Configure your SNS topic to receive Amazon RDS event notifications. For detailed instructions, see the AWS re:Post article
on how to get your Amazon SNS topic to receive Amazon RDS notifications. -
On the Amazon RDS console, create a new event subscription. Set Target to the ARN, and then select the SNS topic you previously created. Set Source type and Event categories to include according to your requirements. For more information, see Subscribing to Amazon RDS event notification in the Amazon RDS documentation.