Hi guys,
It'd be great to be able to support the new(-ish) Filter Policy feature in SNS when specifying an SNS event on a Lambda function.
Something like this would be perfect:
myLambda:
Type: AWS::Serverless::Function
Properties:
Handler: lambda_handlers.handler
...
Events:
SNS:
Type: SNS
Properties:
Topic: !GetAtt someSnsTopic.Arn
FilterPolicy:
AttributeName1:
- value1
- value2
AttributeName2:
- value3
@joshm91 Filter Policy is not available for CloudFormation just yet and therefore not able to be apart of SAM. Marking this as a feature request.
Just yet 馃so it鈥檚 coming 馃お
Fair enough, thanks!
Yes, this would be great. I have several lambdas listening to one SNS topic, and I would vastly prefer being able to filter outside of the lambda invocation. As it is now, my invocation counts aren't very useful.
@jfuss is this available in CloudFormation now? this would be great in sam! thx
It looks like it's available now: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/ReleaseHistory.html
Yes, it's available now. You can find more information about it in this blog post. Hope it's helpful =)
@joshm91 In the CloudFormation template one can also filter on a prefix or a numeric value matching. Do you need this too or does whitelisting (exact string matching) satisfy your use case?
Happy to take PRs on this.
@brettstack a PR is available.
Thanks!
Hey guys. How is it coming together? Thanks a lot
We've just merged this into develop branch and will go out in our next release. Thanks @bottemav 馃檶
Fantastic! Thanks for adding the suppport for SNS message filtering.
Closing this since it's been merged into develop and will be released in the next release.
@brettstack what version will this show up in? I just upgraded with homebrew to 0.9.0 and I'm still getting a "property FilterPolicy not defined for resource of type SNS" error. Thanks
FilterPolicy is not released so SAM CLI doesn't know about this.
When SAM Translator (this repo) updates/cuts a new version with the FilterPolicy in it, SAM CLI will need to cut a release and do a version bump to that version. Until then, this is not available.
When will the next version be released?
We're preparing for a release; policy dictates we can't specify a date, but we're working on it
I'm eagerly waiting on this one. Several sessions at re:Invent (3 months ago now) sold me on using this idea for enabling loosely coupled microservices. I'm using an ugly hack for now to mimic this feature where I do my own filtering in the listeners. 20 lambdas answer and 19 hang up immediately. Not scalable and it probably interferes with the SNS retry logic. If possible, please pressure management to deliver on last year's re:Invent goodness soon. Thanks!
Released!
Works great! Thank you all very much.
Most helpful comment
It looks like it's available now: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/ReleaseHistory.html