0

I'd like to trigger a lambda function after a replication DMS tasks finishes correctly. I only see that I can create topics related to these events:

  • failure
  • configuration
  • change
  • state change
  • creation
  • deletion

It seems that state change would be related, but I guess it's too generic and I couldnt find more info about it. Thanks for your help.

Aleix
  • 431
  • 4
  • 20
  • Seems that state change is the way to go. I will create a topic of these events. Since I'm only interested that my lambda is triggered by a subsed of these events I will create a filter policy. – Aleix Jul 23 '20 at 22:15
  • Aleix - How did you achieve triggering lambda when task is completed ? Can you please share steps and lambda? – Pand005 Dec 18 '20 at 21:58

1 Answers1

2

You can use state change event by checking the event body, perform action in the lambda if DMS event ID is DMS-EVENT-0079

DMS-EVENT-0079

State Change    DMS-EVENT-0079
REPLICATION_TASK_STOPPED – The replication task has stopped.

enter image description here

automating-database-migration-and-refreshing-activities-with-aws-dms

Adiii
  • 54,482
  • 7
  • 145
  • 148
  • Hello Adiii, thanks for your help. I've created this filter but seems that nothing get pass afer it: ```{ "Event ID": [ "http://docs.aws.amazon.com/dms/latest/userguide/CHAP_Events.html#DMS-EVENT-0079" ], "Event Message": [ "Replication task has stopped. Stop Reason FULL_LOAD_ONLY_FINISHED." ] } ``` also I tried ```{ "Event ID": [ "DMS-EVENT-0079" ], "Event Message": [ "FULL_LOAD_ONLY_FINISHED." ] }``` I'm not sure why neither of these don't work. – Aleix Jul 25 '20 at 08:48
  • What about receiving complete change event and analyze the event body once also you can check events inside lambda if trigger does not work properly – Adiii Jul 25 '20 at 08:53
  • I would like to avoid this (that is why filters exist), also it would be an extra cost keeping this lambda always triggered analying messages that are ok and those that are not. Maybe it is because the format DMS sends the message? Look at the value of this attribute: ```"Message": "{\"Event Source\" :\ "replication-task\",\"Event Time\":\"2020-07-24 14:17:28.727\",...,\"Event ID\":\"http://docs.aws.amazon.com...#DMS-EVENT-0079 \",\"Event Message\":\"Replication task has stopped.Stop Reason FULL_LOAD_ONLY_FINISHED.\"}"``` Maybe the slashes are not parsed correctly by the filter – Aleix Jul 25 '20 at 08:58
  • I belive that the starting and enclosing ```"``` characters that wrap the contents of "Message" cause to treat it as a single value, instead of nested objects. – Aleix Jul 25 '20 at 09:30
  • 1
    I used "sns_msg = json.loads(message)" then it removed " character and able to parse the Message Object. Hope this my help! – Pand005 Dec 22 '20 at 03:54