Skip to content
This repository has been archived by the owner on Jan 4, 2024. It is now read-only.

Latest commit

 

History

History
48 lines (41 loc) · 1.22 KB

README.md

File metadata and controls

48 lines (41 loc) · 1.22 KB

#SNS-FILTER-POLICY Cloudformation Custom Resource for SNS Filter Policies

Input:

#required
SubscriptionArn: The subscription which should the filter policy added to
FilterPolicy: List of Attribute/Policy objects

Permission

Sns

  • ListSubscriptionsByTopic

##Example

SnsFilterPolicy: 
  Type: "Custom::SnsFilterPolicy"
  Properties: 
    ServiceToken:
      !Sub |
        arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${LambdaFunctionName}
    SubscriptionArn: arn:to:subscription
    FilterPolicy:
      #Exact matching (whitelisting)
      - Attribute: customer_interests
        Policy: '["rugby"]'
      #Prefix matching
      - Attribute: customer_interests
        Policy: '[{"prefix":"bas"}]'
      #Anything-but matching (blacklisting)
      - Attribute: customer_interests
        Policy: '["customer_interests": [{"anything-but":"rugby"}]'
      # Numeric exact matching
      - Attribute: "price_usd"
        Policy: '[{"numeric":["=",301.5]}]'
      #Range matching
      - Atttribute: "price_usd"
        Policy: '[{"numeric":[">", 0, "<=", 150]}]'
    StackName: 
      Ref: "StackName"      

For more information see https://docs.aws.amazon.com/sns/latest/dg/message-filtering.html