SNS message body filtering s3 key ignore suffix

34 Views Asked by At

I have an s3 key that can either be document/<date>/<uuid>-updated.json or document/<date>/<uuid>.json. I am wanting to set up two separate subscriptions to two separate queues, with one queue only receiving the updated.json related events, and the other queue receiving the <uuid>.json events. What would that filter policy look like? I can't figure out how to get anything-but to work with a suffix on the filter policy for the message body.

What I have for the -updated.json subscription is:

{
  "Records": {
    "s3": {
      "object": {
        "key": [
          {
            "prefix": "document"
          },
          {
            "suffix": "-updated.json"
          }
        ]
      }
    }
  }
}

What I have for the <uuid>.json subscription is:

{
  "Records": {
    "s3": {
      "object": {
        "key": [
          {
            "anything-but": [
              "updated.json"
            ]
          },
          {
            "prefix": "document"
          },
          {
            "suffix": ".json"
          }
        ]
      }
    }
  }
}

Whenever I publish a test message for each type of key that could be received, each one of the queues is still receiving both messages.

0

There are 0 best solutions below