8

I want an SNS topic to trigger an Eventbridge event, so that I can invoke an ECS task. I have tried to connect an Eventbridge rule to an SNS topic as follows (this is my event pattern for the eventbridge rule):

{
  "source": [
    "aws.sns"
  ],
  "region": [
    "eu-west-1"
  ],
  "resources": [
    "arn:aws:sns:eu-west-1:xxx:myTestTopicForECS"
  ]
}

However, when I publish a message to this topic, the Eventbridge rule doesn't get triggered. I have tried to see if anyone else has this problem, but haven't been able to find anything. How do I solve this?

Andreas Forslöw
  • 2,220
  • 23
  • 32
  • 2
    I'm also interested in this functionality, but can't seem to find a solution. –  Mar 17 '21 at 16:14

2 Answers2

6

@HolyM, He wants the SNS topic to act as a source to eventBridge, not a destination.

@Andreas Forslöw, you cant do it, because eventBridge listen to events of AWS resources, publish a message to the topic is not resource change.

Instead, you can subscribe to a topic with lambda which invokes an ECS task.

1

You could also write a small lambda that subscribes to the topic and uses the EventBridge PutEvents API.

joshwa
  • 1,660
  • 3
  • 17
  • 26