Monitoring of DMS Tasks on Slack

ruchi khanuja
2 min readMay 21, 2021

I have been working with AWS Database Migration service for a long time.It gets challenging to monitor the replication tasks running in AWS Database Migration service specially if there are many.Here is an easy way to setup active monitoring of AWS Database Migration service(DMS) on slack.Follow these simple steps to setup the same:

  1. Login to AWS console- > go to service ‘DMS’ ( Database Migration service)
  2. Click on Event Subscriptions →Give a name to the subscription, and as a target of this event subscription select any existing SNS Topic from the drop down or create a new one.
  3. Select “replication-task” from the drop down as Event Source.As we want to monitor the DMS replication tasks and their statuses.
  4. In Event Categories drop down( you can select All) or choose a specific event for e.g. “State Change”. If you choose “State Change” , you will be notified whenever the status of the DMS replication task changes for e.g. created, starting, running, stopped etc
  5. In Replication Tasks drop down- either select All tasks or choose specific DMS replication task, Click on “create event subscription”.
  6. In the details of this Event Subscription you can see ARNs of this Event and ARN of target SNS Topic.
  7. Create an app on slack and enable incoming webhooks for this app by following the instructions here https://api.slack.com/messaging/webhooks
  8. After step 7 you should have the webhook URL and a slack channel which is linked to this URL.When you post a message this webhook url, same appears on slack channel as well which is linked to this webhook.
  9. In AWS console select service ‘Lambda’ to run the Server-less processing of the messages coming from SNS topic that was setup in step 6.
  10. Choose SNS topic from step 6 as Trigger for this lambda. Write a small python program to parse the messages incoming from the SNS Topic and post it to slack.
  11. For posting it to slack use the incoming webhook created in step 7 for e.g

response = requests.post(url=webhookurl, json=json_message)

There you go, It was not hard,was it? In this way you are notified on slack about the status changes of the DMS replication tasks.

--

--