Using Amazon RDS Event Notification

Amazon RDS uses the Amazon Simple Notification Service (Amazon SNS) to provide notification when an Amazon RDS event occurs. These notifications can be in any notification form supported by Amazon SNS for an AWS Region, such as an email, a text message, or a call to an HTTP endpoint.

Amazon RDS groups these events into categories that you can subscribe to so that you can be notified when an event in that category occurs. You can subscribe to an event category for a DB instance, DB snapshot, DB parameter group, or DB security group. For example, if you subscribe to the Backup category for a given DB instance, you are notified whenever a backup-related event occurs that affects the DB instance. If you subscribe to a configuration change category for a DB security group, you are notified when the DB security group is changed. You also receive notification when an event notification subscription changes.

Event notifications are sent to the addresses that you provide when you create the subscription. You might want to create several different subscriptions, such as one subscription receiving all event notifications and another subscription that includes only critical events for your production DB instances. You can easily turn off notification without deleting a subscription by choosing No for Enabled in the Amazon RDS console or by setting the Enabled parameter to false using the AWS CLI or Amazon RDS API.

Important Amazon RDS doesn't guarantee the order of events sent in an event stream. The event order is subject to change.

Note Amazon RDS event notifications using SMS text messages are currently available for topic Amazon Resource Names (ARNs) and Amazon RDS resources in the US-East (Northern Virginia) Region. For more information on using text messages with SNS, see Sending and Receiving SMS Notifications Using Amazon SNS in the Amazon Simple Notification Service Developer Guide.

Amazon RDS uses the ARN of an Amazon SNS topic to identify each subscription. The Amazon RDS console creates the ARN for you when you create the subscription. If you use the CLI or API, you create the ARN by using the Amazon SNS console or the Amazon SNS API when you create a subscription.

Billing for Amazon RDS event notification is through the Amazon Simple Notification Service (Amazon SNS). Amazon SNS fees apply when using event notification. For more information on Amazon SNS billing, see Amazon Simple Notification Service Pricing .

The process for subscribing to Amazon RDS event notification is as follows:

Create an Amazon RDS event notification subscription by using the Amazon RDS console, AWS CLI, or API. Amazon RDS sends an approval email or SMS message to the addresses you submitted with your subscription. To confirm your subscription, choose the link in the notification you were sent. When you have confirmed the subscription, the status of your subscription is updated in the Amazon RDS console's My Event Subscriptions section. You then begin to receive event notifications.

Note When Amazon SNS sends a notification to a subscribed HTTP or HTTPS endpoint, the POST message sent to the endpoint has a message body that contains a JSON document. For more information, see Amazon SNS Message and JSON Formats in the Amazon Simple Notification Service Developer Guide. You can use AWS Lambda to process event notifications from a DB instance. For more information, see Using AWS Lambda with Amazon RDS in the AWS Lambda Developer Guide.

The following section lists all categories and events that you can be notified of. It also provides information about subscribing to and working with Amazon RDS event subscriptions.

Amazon RDS Event Categories and Event Messages

Amazon RDS generates a significant number of events in categories that you can subscribe to using the Amazon RDS Console, AWS CLI, or the API. Each category applies to a source type, which can be a DB instance, DB snapshot, DB security group, or DB parameter group.

The following table shows the event category and a list of events when a DB instance is the source type.

The following table shows the event category and a list of events when a DB parameter group is the source type.

Category RDS Event ID Description configuration change RDS-EVENT-0037 The parameter group was modified.

The following table shows the event category and a list of events when a DB security group is the source type.

Category RDS Event ID Description configuration change RDS-EVENT-0038 The security group has been modified. failure RDS-EVENT-0039 The security group owned by [user] does not exist; authorization for the security group has been revoked.

The following table shows the event category and a list of events when a DB snapshot is the source type.

Category RDS Event ID Description creation RDS-EVENT-0040 A manual DB snapshot is being created. creation RDS-EVENT-0042 A manual DB snapshot has been created. creation RDS-EVENT-0090 An automated DB snapshot is being created. creation RDS-EVENT-0091 An automated DB snapshot has been created. deletion RDS-EVENT-0041 A DB snapshot has been deleted. notification RDS-EVENT-0059 Started the copy of the cross region DB snapshot [DB snapshot name] from source region [region name]. notification RDS-EVENT-0060 Finished the copy of the cross region DB snapshot [DB snapshot name] from source region [region name] in [time] minutes. notification RDS-EVENT-0061 The copy of a cross region DB snapshot failed. notification RDS-EVENT-0159 DB snapshot export task failed. notification RDS-EVENT-0160 DB snapshot export task canceled. notification RDS-EVENT-0161 DB snapshot export task completed. restoration RDS-EVENT-0043 A DB instance is being restored from a DB snapshot.

The following table shows the event category and a list of events when an Aurora DB cluster is the source type.

The following table shows the event category and a list of events when an Aurora DB cluster snapshot is the source type.

Category RDS Event ID Description backup RDS-EVENT-0074 Creation of a manual DB cluster snapshot has started. backup RDS-EVENT-0075 A manual DB cluster snapshot has been created. notification RDS-EVENT-0162 DB cluster snapshot export task failed. notification RDS-EVENT-0163 DB cluster snapshot export task canceled. notification RDS-EVENT-0164 DB cluster snapshot export task completed. backup RDS-EVENT-0168 Creating automated cluster snapshot. backup RDS-EVENT-0169 Automated cluster snapshot created. creation RDS-EVENT-0170 DB cluster created. deletion RDS-EVENT-0171 DB cluster deleted. notification RDS-EVENT-0172 Renamed DB cluster from [old DB cluster name] to [new DB cluster name].

Subscribing to Amazon RDS Event Notification

You can create an Amazon RDS event notification subscription so you can be notified when an event occurs for a given DB instance, DB snapshot, DB security group, or DB parameter group. The simplest way to create a subscription is with the RDS console. If you choose to create event notification subscriptions using the CLI or API, you must create an Amazon Simple Notification Service topic and subscribe to that topic with the Amazon SNS console or Amazon SNS API. You will also need to retain the Amazon Resource Name (ARN) of the topic because it is used when submitting CLI commands or API operations. For information on creating an SNS topic and subscribing to it, see Getting Started with Amazon SNS in the Amazon Simple Notification Service Developer Guide.

You can specify the type of source you want to be notified of and the Amazon RDS source that triggers the event. These are defined by the SourceType (type of source) and the SourceIdentifier (the Amazon RDS source generating the event). If you specify both the SourceType and SourceIdentifier, such as SourceType = db-instance and SourceIdentifier = myDBInstance1 , you receive all the DB instance events for the specified source. If you specify a SourceType but don't specify a SourceIdentifier, you receive notice of the events for that source type for all your Amazon RDS sources. If you don't specify either the SourceType or the SourceIdentifier, you are notified of events generated from all Amazon RDS sources belonging to your customer account.

Note Event notifications might take up to five minutes to be delivered. Amazon RDS event notification is only available for unencrypted SNS topics. If you specify an encrypted SNS topic, event notifications aren't sent for the topic.

To subscribe to RDS event notification Sign in to the AWS Management Console and open the Amazon RDS console at https://console.aws.amazon.com/rds/ . In navigation pane, choose Event subscriptions. In the Event subscriptions pane, choose Create event subscription. In the Create event subscription dialog box, do the following: For Name, enter a name for the event notification subscription. For Send notifications to, choose an existing Amazon SNS ARN for an Amazon SNS topic, or choose create topic to enter the name of a topic and a list of recipients. For Source type, choose a source type. Choose Yes to enable the subscription. If you want to create the subscription but to not have notifications sent yet, choose No. Depending on the source type you selected, choose the event categories and sources that you want to receive event notifications for. Choose Create. The Amazon RDS console indicates that the subscription is being created. To subscribe to RDS event notification, use the AWS CLI create-event-subscription command. Include the following required parameters: --subscription-name

--sns-topic-arn Example For Linux, macOS, or Unix: aws rds create-event-subscription \ --subscription-name myeventsubscription \ --sns-topic-arn arn:aws:sns:us-east-1:802#########:myawsuser-RDS \ --enabled For Windows: aws rds create-event-subscription ^ --subscription-name myeventsubscription ^ --sns-topic-arn arn:aws:sns:us-east-1:802#########:myawsuser-RDS ^ --enabled To subscribe to Amazon RDS event notification, call the Amazon RDS API function CreateEventSubscription . Include the following required parameters: SubscriptionName

SnsTopicArn

Listing Your Amazon RDS Event Notification Subscriptions

You can list your current Amazon RDS event notification subscriptions.

To list your current Amazon RDS event notification subscriptions Sign in to the AWS Management Console and open the Amazon RDS console at https://console.aws.amazon.com/rds/ . In the navigation pane, choose Event subscriptions. The Event subscriptions pane shows all your event notification subscriptions. To list your current Amazon RDS event notification subscriptions, use the AWS CLI describe-event-subscriptions command. Example The following example describes all event subscriptions. aws rds describe-event-subscriptions The following example describes the myfirsteventsubscription . aws rds describe-event-subscriptions --subscription-name myfirsteventsubscription To list your current Amazon RDS event notification subscriptions, call the Amazon RDS API DescribeEventSubscriptions action. Example The following code example lists up to 100 event subscriptions. https://rds.us-east-1.amazonaws.com/ ?Action=DescribeEventSubscriptions &MaxRecords=100 &SignatureMethod=HmacSHA256 &SignatureVersion=4 &Version=2014-10-31 &X-Amz-Algorithm=AWS4-HMAC-SHA256 &X-Amz-Credential=AKIADQKE4SARGYLE/20140428/us-east-1/rds/aws4_request &X-Amz-Date=20140428T161907Z &X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date &X-Amz-Signature=4208679fe967783a1a149c826199080a066085d5a88227a80c6c0cadb3e8c0d4 The following example describes the myfirsteventsubscription . https://rds.us-east-1.amazonaws.com/ ?Action=DescribeEventSubscriptions &SignatureMethod=HmacSHA256 &SignatureVersion=4 &SubscriptionName=myfirsteventsubscription &Version=2014-10-31 &X-Amz-Algorithm=AWS4-HMAC-SHA256 &X-Amz-Credential=AKIADQKE4SARGYLE/20140428/us-east-1/rds/aws4_request &X-Amz-Date=20140428T161907Z &X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date &X-Amz-Signature=4208679fe967783a1a149c826199080a066085d5a88227a80c6c0cadb3e8c0d4

Modifying an Amazon RDS Event Notification Subscription

After you have created a subscription, you can change the subscription name, source identifier, categories, or topic ARN.

To modify an Amazon RDS event notification subscription Sign in to the AWS Management Console and open the Amazon RDS console at https://console.aws.amazon.com/rds/ . In the navigation pane, choose Event subscriptions. In the Event subscriptions pane, choose the subscription that you want to modify and choose Edit. Make your changes to the subscription in either the Target or Source section. Choose Edit. The Amazon RDS console indicates that the subscription is being modified. To modify an Amazon RDS event notification subscription, use the AWS CLI modify-event-subscription command. Include the following required parameter: --subscription-name Example The following code enables myeventsubscription . For Linux, macOS, or Unix: aws rds modify-event-subscription \ --subscription-name myeventsubscription \ --enabled For Windows: aws rds modify-event-subscription ^ --subscription-name myeventsubscription ^ --enabled To modify an Amazon RDS event, call the Amazon RDS API operation ModifyEventSubscription . Include the following required parameter: SubscriptionName

Adding a Source Identifier to an Amazon RDS Event Notification Subscription

You can add a source identifier (the Amazon RDS source generating the event) to an existing subscription.

You can easily add or remove source identifiers using the Amazon RDS console by selecting or deselecting them when modifying a subscription. For more information, see Modifying an Amazon RDS Event Notification Subscription. To add a source identifier to an Amazon RDS event notification subscription, use the AWS CLI add-source-identifier-to-subscription command. Include the following required parameters: --subscription-name

--source-identifier Example The following example adds the source identifier mysqldb to the myrdseventsubscription subscription. For Linux, macOS, or Unix: aws rds add-source-identifier-to-subscription \ --subscription-name myrdseventsubscription \ --source-identifier mysqldb For Windows: aws rds add-source-identifier-to-subscription ^ --subscription-name myrdseventsubscription ^ --source-identifier mysqldb To add a source identifier to an Amazon RDS event notification subscription, call the Amazon RDS API AddSourceIdentifierToSubscription . Include the following required parameters: SubscriptionName

SourceIdentifier

Removing a Source Identifier from an Amazon RDS Event Notification Subscription

You can remove a source identifier (the Amazon RDS source generating the event) from a subscription if you no longer want to be notified of events for that source.

You can easily add or remove source identifiers using the Amazon RDS console by selecting or deselecting them when modifying a subscription. For more information, see Modifying an Amazon RDS Event Notification Subscription. To remove a source identifier from an Amazon RDS event notification subscription, use the AWS CLI remove-source-identifier-from-subscription command. Include the following required parameters: --subscription-name

--source-identifier Example The following example removes the source identifier mysqldb from the myrdseventsubscription subscription. For Linux, macOS, or Unix: aws rds remove-source-identifier-from-subscription \ --subscription-name myrdseventsubscription \ --source-identifier mysqldb For Windows: aws rds remove-source-identifier-from-subscription ^ --subscription-name myrdseventsubscription ^ --source-identifier mysqldb To remove a source identifier from an Amazon RDS event notification subscription, use the Amazon RDS API RemoveSourceIdentifierFromSubscription command. Include the following required parameters: SubscriptionName

SourceIdentifier

Listing the Amazon RDS Event Notification Categories

All events for a resource type are grouped into categories. To view the list of categories available, use the following procedures.

When you create or modify an event notification subscription, the event categories are displayed in the Amazon RDS console. For more information, see Modifying an Amazon RDS Event Notification Subscription. To list the Amazon RDS event notification categories, use the AWS CLI describe-event-categories command. This command has no required parameters. Example aws rds describe-event-categories To list the Amazon RDS event notification categories, use the Amazon RDS API DescribeEventCategories command. This command has no required parameters.

Deleting an Amazon RDS Event Notification Subscription

You can delete a subscription when you no longer need it. All subscribers to the topic will no longer receive event notifications specified by the subscription.