Working with events and notifications in AWS Database Migration Service - AWS Database Migration Service

Working with events and notifications in AWS Database Migration Service

AWS Database Migration Service (AWS DMS) uses Amazon Simple Notification Service (Amazon SNS) to provide notifications when an AWS DMS event occurs, for example the creation or deletion of a replication instance. You can work with these notifications in any form supported by Amazon SNS for an AWS Region, such as an email message, a text message, or a call to an HTTP endpoint.

AWS DMS groups events into categories that you can subscribe to, so you can be notified when an event in that category occurs. For example, if you subscribe to the Creation category for a given replication instance, you are notified whenever a creation-related event occurs that affects your replication instance. If you subscribe to a Configuration Change category for a replication instance, you are notified when the replication instance's configuration is changed. You also receive notification when an event notification subscription changes. For a list of the event categories provided by AWS DMS, see AWS DMS event categories and event messages, following.

AWS DMS sends event notifications to the addresses you provide when you create an event 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 DMS resources. You can easily turn off notification without deleting a subscription by deselecting the Enabled option in the AWS DMS console, or by setting the Enabled parameter to false using the AWS DMS API.

Note

AWS DMS event notifications using SMS text messages are currently available for AWS DMS resources in all AWS Regions where AWS DMS is supported. For more information on using text messages with SNS, see Sending and receiving SMS notifications using Amazon SNS.

AWS DMS uses a subscription identifier to identify each subscription. You can have multiple AWS DMS event subscriptions published to the same Amazon SNS topic. When you use event notification, Amazon SNS fees apply; for more information on Amazon SNS billing, see Amazon SNS pricing.

To subscribe to AWS DMS events, you use the following process:

  1. Create an Amazon SNS topic. In the topic, you specify what type of notification you want to receive and to what address or number the notification will go to.

  2. Create an AWS DMS event notification subscription by using the AWS Management Console, AWS CLI, or AWS DMS API.

  3. AWS DMS sends an approval email or SMS message to the addresses you submitted with your subscription. To confirm your subscription, click the link in the approval email or SMS message.

  4. When you have confirmed the subscription, the status of your subscription is updated in the AWS DMS console's Event subscriptions section.

  5. You then begin to receive event notifications.

For the list of categories and events that you can be notified of, see the following section. For more details about subscribing to and working with AWS DMS event subscriptions, see Subscribing to AWS DMS event notification.

AWS DMS event categories and event messages

AWS DMS generates a significant number of events in categories that you can subscribe to using the AWS DMS console or the AWS DMS API. Each category applies to a source type; currently AWS DMS supports the replication instance and replication task source types.

The following table shows the possible categories and events for the replication instance source type.

Category

DMS event ID

Description

Configuration Change DMS-EVENT-0012

The replication instance class for this replication instance is being changed.

Configuration Change DMS-EVENT-0014

The replication instance class for this replication instance has changed.

Configuration Change DMS-EVENT-0018

The storage for the replication instance is being increased.

Configuration Change DMS-EVENT-0017

The storage for the replication instance has been increased.

Configuration Change DMS-EVENT-0024

The replication instance is transitioning to a Multi-AZ configuration.

Configuration Change DMS-EVENT-0025

The replication instance has finished transitioning to a Multi-AZ configuration.

Configuration Change DMS-EVENT-0030

The replication instance is transitioning to a Single-AZ configuration.

Configuration Change DMS-EVENT-0029

The replication instance has finished transitioning to a Single-AZ configuration.

Creation DMS-EVENT-0067

A replication instance is being created.

Creation DMS-EVENT-0005

A replication instance has been created.

Deletion DMS-EVENT-0066

The replication instance is being deleted.

Deletion DMS-EVENT-0003

The replication instance has been deleted.

Maintenance DMS-EVENT-0047 Management software on the replication instance has been updated.
Maintenance DMS-EVENT-0026 Offline maintenance of the replication instance is taking place. The replication instance is currently unavailable.
Maintenance DMS-EVENT-0027 Offline maintenance of the replication instance is complete. The replication instance is now available.
Maintenance DMS-EVENT-0068 Replication instance is in a state that cannot be upgraded.
LowStorage DMS-EVENT-0007 Free storage for the replication instance is low.
Failover DMS-EVENT-0013 Failover started for a Multi-AZ replication instance.
Failover DMS-EVENT-0049 Failover has been completed for a Multi-AZ replication instance.
Failover DMS-EVENT-0015 Multi-AZ failover to standby complete.
Failover DMS-EVENT-0050 Multi-AZ activation has started.
Failover DMS-EVENT-0051 Multi-AZ activation completed.
Failover DMS-EVENT-0034 If you request Failover too frequently, this event occurs instead of regular failover events.
Failure DMS-EVENT-0031 The replication instance has gone into storage failure.
Failure DMS-EVENT-0036 The replication instance has failed due to an incompatible network.
Failure DMS-EVENT-0037 When service is unable to access the KMS key used to encrypt the data volume.

The following table shows the possible categories and events for the replication task source type.

Category

DMS event ID

Description

State Change DMS-EVENT-0069

The replication task has started.

State Change DMS-EVENT-0077

The replication task has started CDC.

State Change DMS-EVENT-0081

Reload of table details has been requested.

State Change DMS-EVENT-0079

The replication task has stopped.

Failure DMS-EVENT-0078

A replication task has failed.

Failure DMS-EVENT-0082

A call to clean task data has failed.

ConfigurationChange DMS-EVENT-0080 A replication task has been modified.
Deletion DMS-EVENT-0073

The replication task has been deleted.

Creation DMS-EVENT-0074 The replication task has been created.

The following example models an AWS DMS event subscription with State Change category.

Resources: DMSEvent: Type: AWS::DMS::EventSubscription Properties: Enabled: true EventCategories: State Change SnsTopicArn: arn:aws:sns:us-east-1:123456789:testSNS SourceIds: [] SourceType: replication-task

Subscribing to AWS DMS event notification

You can create an AWS DMS event notification subscription so you can be notified when an AWS DMS event occurs. The simplest way to create a subscription is with the AWS DMS console. In a notification subscription, you choose how and where to send notifications. You specify the type of source you want to be notified of; currently AWS DMS supports the replication instance and replication task source types. And, depending on the source type you select, you choose the event categories and identify the source you want to receive event notifications for.

Using AWS Management Console

To subscribe to AWS DMS event notification by using the console

  1. Sign in to the AWS Management Console and choose AWS DMS. Note that if you are signed in as an AWS Identity and Access Management (IAM) user, you must have the appropriate permissions to access AWS DMS.

  2. In the navigation pane, choose Event subscriptions.

  3. On the Event subscriptions page, choose Create event subscription.

  4. On the Create event subscription page, do the following:

    1. Under Details, for Name, type a name for the event notification subscription.

    2. Select Enabled to enable the subscription. If you want to create the subscription but not have notifications sent yet, don't select Enabled.

    3. Under Target, choose either Existing topics, Create new email topic or Create new SMS topic to send notifications. You must have either an existing Amazon SNS topic to send notices to or you must create the topic. If you choose to create a topic, you can enter an email address where notifications will be sent.

    4. Under Event source, for Source type, choose a source type. The only options are replication-instance and replication-task.

    5. Depending on the source type you selected, choose the event categories and sources you want to receive event notifications for.

      
                                   Console create event subscription
    6. Select Create event subscription.

The AWS DMS console indicates that the subscription is being created.

Using AWS DMS API and CLI

If you choose to create event notification subscriptions using AWS DMS API, you must create an Amazon SNS topic and subscribe to that topic with the Amazon SNS console or API. In this case, you also need to note the topic's Amazon Resource Name (ARN), because this ARN is used when submitting CLI commands or API actions. For information on creating an Amazon SNS topic and subscribing to it, see Getting started with Amazon SNS.

In a notification subscription created using the AWS DMS API or CLI, you can specify the type of source you want to be notified of, and the AWS DMS source that triggers the event. You define the type of source by specifying a source type value. You define the source generating the event by specifying a source identifier value.

The following create-event-subscription example shows the syntax to create event notification subscriptions using the AWS CLI.

aws dms create-event-subscription \ --subscription-name string \ --sns-topic-arn string \ [--source-type string] \ [--event-categories string] \ [--source-ids string] \ [--enabled | --no-enabled] \ [--tags string] \ [--cli-input-json string] \ [--generate-cli-skeleton string]

To subscribe to AWS DMS event notification using the AWS DMS API, call the CreateEventSubscription action. The following provides an example request syntax for the CreateEventSubscription API.

{ "Enabled": boolean, "EventCategories": [ "string" ], "SnsTopicArn": "string", "SourceIds": [ "string" ], "SourceType": "string", "SubscriptionName": "string", "Tags": [ { "Key": "string", "Value": "string" } ] }