Search code examples
amazon-web-servicesamazon-sns

Filter messages in AWS SNS subscription


I created a SNS subscription and started receiving bunch of emails

I'm interested in receiving only following emails:

All emails with New Compliance Change Record or complianceType in message body

I found this guide https://docs.aws.amazon.com/sns/latest/dg/message-filtering.html, according to this i need to specify value for complianceType which is not what i want.

I need to get any email with with New Compliance Change Record or complianceType in message body

New Compliance Change Record:
----------------------------
{
"awsAccountId": "123456789",
"configRuleName": "encrypted-volumes",
"configRuleARN": "arn:aws:config:us-east-1:279052847476:config-rule/config-rule-3sovvx",
"resourceType": "AWS::EC2::Volume",
"resourceId": "vol-0f4f07ce39ca10b26",
"awsRegion": "us-east-1",
"newEvaluationResult": {
"evaluationResultIdentifier": {
"evaluationResultQualifier": {
"configRuleName": "encrypted-volumes",
"resourceType": "AWS::EC2::Volume",
"resourceId": "vol-0f4f07ce39ca10b26"
},
"orderingTimestamp": "2018-06-12T00:31:39.624Z"
},
"complianceType": "NON_COMPLIANT",
"resultRecordedTime": "2018-06-12T00:31:43.838Z",
"configRuleInvokedTime": "2018-06-12T00:31:43.595Z",
"annotation": null,
"resultToken": null
},

Tried this:

{
"complianceType" : {"Type":"String","Value":"*"}
}

but got error from pictureenter image description here

managed to set this filter though, but not sure is it correct

{
"complianceType" :["NON_COMPLIANT","COMPLIANT"]
}

Solution

  • You can now use payload-based message filtering to address your need: https://aws.amazon.com/blogs/compute/introducing-payload-based-message-filtering-for-amazon-sns/