Forked from daniel-woods/gist:bda445616d59e4f8b98e93735a298b79
Created
September 29, 2018 02:40
-
-
Save vvalorous/7a8b5b0946bc8605485b3d0d62662ff2 to your computer and use it in GitHub Desktop.
sns_SubscribeAddFilterPolicy.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import boto3 | |
import json | |
sns = boto3.client("sns") | |
topic_arn = "YOUR_SNS_TOPIC" | |
proto = "http" | |
endpoint = "YOUR_EDNPOINT" | |
attributes = {"FilterPolicy": json.dumps({"key": ["foo", "bar"]})} | |
subscription_resp = sns.subscribe(TopicArn=topic_arn, Protocol=proto, Endpoint=endpoint, Attributes=attributes, ReturnSubscriptionArn=True) | |
print("\nSUBSCRIBE:\n" + json.dumps(subscription_resp, indent=4)) | |
get_attributes_resp = sns.get_subscription_attributes(SubscriptionArn=subscription_resp["SubscriptionArn"]) | |
print("\nGET_SUBSCRIPTIONS_ATTRIBUTES:\n" + json.dumps(get_attributes_resp, indent=4)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment