Search code examples
amazon-web-servicesamazon-snsaws-event-bridge

How to connect AWS Eventbridge to an SNS topic


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?


Solution

  • @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.