Skip to content

How do I get my Amazon SNS topic to receive Amazon RDS notifications?

3 minute read
0

I want my Amazon Simple Notification Service (Amazon SNS) topic to receive Amazon Relational Database Service (Amazon RDS) notifications.

Resolution

Grant Amazon RDS permissions to publish events to your SNS topic

Complete the following steps:

  1. Open the Amazon SNS console.

  2. In the navigation panel, choose Topics, then select the topic that you want to configure for RDS notifications.

  3. Choose the Access policy tab, and then choose Edit.

  4. Expand Access policy – optional.

  5. In the JSON editor, enter the following permissions policy:

    {
      "Version":"2012-10-17",		 	 	 
      "Statement": [
        {
          "Effect": "Allow",
          "Principal": {
            "Service": "events.rds.amazonaws.com"
          },
          "Action": [
            "sns:Publish"
          ],
          "Resource": "arn:aws:sns:us-east-1:123456789012:topic_name",
          "Condition": {
            "ArnLike": {
              "aws:SourceArn": "arn:aws:rds:us-east-1:123456789012:db:prefix-*"
            },
            "StringEquals": {
              "aws:SourceAccount": "123456789012"
            }
          }
        }
      ]
    }

    Note: Replace the Resource value with your SNS topic Amazon Resource Name (ARN). Replace aws:SourceAccount with your AWS source account ID, and aws:SourceArn with your Amazon RDS ARN.

  6. Choose Save changes.

For more information, see Granting permissions to publish notifications to an Amazon SNS topic.

Activate encryption for your SNS topic

Complete the following steps:

  1. Open the Amazon SNS console.

  2. In the navigation panel, choose Topics, then select the topic you want to configure for RDS notifications.

  3. Choose the Encryption tab, and then choose Edit.

  4. Expand Encryption -- optional, and then turn Encryption on.

  5. For AWS KMS key, choose an AWS Key Management Service (AWS KMS) customer managed key.
    Note: You must encrypt the Amazon SNS topic with a customer managed key because you can't modify the default AWS managed KMS key.

  6. Choose Save changes.

  7. Open the AWS KMS console.

  8. In the navigation pane, choose Customer managed keys.

  9. Choose your customer managed key, and then choose the Key policy tab.

  10. Choose Edit, and then add the following statement to your customer managed key policy:

    {
      "Statement": [{
        "Effect": "Allow",
        "Principal": {
          "Service": "events.rds.amazonaws.com"
        },
        "Action": [
          "kms:GenerateDataKey*",
          "kms:Decrypt"
        ],
        "Resource": "*"
      }]
    }
  11. Choose Save changes.

For more information, see Activate compatibility between event sources from AWS services and encrypted topics.

Configure the event subscriptions notification type

Select the event subscription notification type for your scenario. For example, to receive notifications about instance restarts and shutdowns, select availability as the event category and Instances as the source type.

Complete the following steps:

  1. Open the Aurora and RDS console.
  2. In the navigation panel, choose Event subscriptions, and then choose your event subscription.
  3. In the Event subscription details section of your subscription page, review the values in Source type, Sources, and Event categories.
  4. To change the event subscription values, choose the Actions dropdown list, and then select Edit.
  5. Choose the correct source and event category for the type of event that fits your scenario, and then choose Save.

(Optional) Configure event notifications for all instances when shutdown events occurr

Complete the following steps:

  1. Open the Aurora and RDS console.
  2. In the navigation pane, choose Event subscriptions, and then choose your event subscription.
  3. Choose the Actions dropdown list, and then select Edit.
  4. Choose the Source type dropdown list, and then select Instances.
  5. For Instances to include, select All instances.
  6. For Event categories to include, select specific event categories.
  7. For Specific event categories, select availability.
  8. Choose Save.

For more information on the different types of supported events and their categories, see Amazon RDS event categories and event messages.

Related information

Working with Amazon RDS event notification