I’m trying to schedule the deletion of a DMS Replication Instance whenever its ReplicationTask is “finished”. I have a working Cloudformation template to create the Replication Instance and Replication Task. I have a Lambda function to delete the stack. I’m now trying to trigger the Lambda function with an Eventbridge event pattern. However DMS only logs a portion of the ReplicationTask ARN, it doesn’t log the ReplicationTaskIdentifier (friendly name) or tags. I’m guessing I need to use an intrinsic function to get the ARN of the Replication Task and insert it into an event pattern. How can I do this, or this there a better way to accomplish this?
Here’s what I tried for the Event Pattern using Fn::GetAtt for the ARN of the ReplicationTask, along with Lambda function creation-
EventBridgeRule:
Type: AWS::Events::Rule
Properties:
Name: cfstst2-dms-repkill
EventPattern: >-
{“source”:[“aws.dms”],”detail”:{“eventSource”:[“dms.amazonaws.com”],”detailMessage”:[{“wildcard”:”FINISHED“}],”resources”:[{“Fn::GetAtt”: [“cftst2-test, Arn”]}]}
State: ENABLED
EventBusName: default
Targets:
– Id: Id02e6f6d0-0f0c-4475-8c92-32a9faf7956f
Arn:
Fn::Sub: >-
arn:${AWS::Partition}:lambda:${AWS::Region}:${AWS::AccountId}:function:del-dms-repstack
Parameters: {}