Category : amazon-sns

I’m trying to publish messages to SNS with my python lambda function in AWS, my code is: import boto3 sns = boto3.client(‘sns’) … sns.publish( TopicArn=metadata_item.get(‘snsArn’), Message=json.dumps({‘default’: json.dumps(metadata_item)}), MessageStructure=’json’ ) Looks like all right, but i still getting this error: { "errorMessage": "An error occurred (InvalidParameter) when calling the Publish operation: Invalid parameter: Topic Name", "errorType": ..

Read more

Hi i need to list a specific environment SNS topic using BOTO3, im using this script but it not working. import boto3 import re client = boto3.client(‘sns’, region_name=’ap-southeast-1′) response = client.list_topics() #print(response) #list_topics=[] for each_reg in response[‘Topics’]: print(each_reg[‘TopicArn’]) #x= each_reg[‘TopicArn’].search(‘_dev’) if x: list_topic.append(each_reg[‘TopicArn’]) print (list_topic) #topics=response[‘Topics’] #x = re.findall("_dev", topics) #print(topics) #for response in topics[‘TopicArn’]: ..

Read more

Im trying to list the sns topic using boto3 im using this code import boto3 import pprint response = client.list_topics( NextToken=’string’ ) list_topics=[] for each_reg in response[‘topic’]: print(each_reg[‘topic]) but im geting this error File "kri.py", line 14 print(each_reg[‘topic]) ^ SyntaxError: EOL while scanning string literal Source: Python..

Read more

I wrote this code from the python cdk library documentation: https://docs.aws.amazon.com/cdk/api/latest/python/modules.html topic = sns.Topic(self , id = env + "-my-EventTopic" , display_name = ‘my name’ , topic_name = env + "-my-EventTopic" ) q1_filter = sns.SubscriptionFilter( conditions = [sns.SubscriptionFilter.string_filter(whitelist=[‘{"action":["Q1_BACKUP"]}’])] ) q2_filter = sns.SubscriptionFilter( conditions=[sns.SubscriptionFilter.string_filter(whitelist=[‘{"action":["Q2_BACKUP"]}’])] ) topic.add_subscription(sns_subs.SqsSubscription( queue = queue2 , filter_policy={‘action’:q1_filter} )) topic.add_subscription(sns_subs.SqsSubscription( queue = queue1 ..

Read more