所以我通过控制台创建了一个SNS主题,然后尝试调用list_subscriptions_by_topic
或sns.publish
,但都失败了,因为
An error occurred (NotFound) when calling the Publish
operation: Topic does not exist: NotFoundException
那么是什么给了???在SNS控制台中可以访问该主题。你知道吗
这是我的lambda代码:
from __future__ import print_function
import json
import boto3
import random
print('Loading function')
sns = boto3.client('sns')
def lambda_handler(event, context):
response = sns.publish(
TopicArn='arn:aws:sns:us-west-2:031436316123:topicExists'
Message=json.dumps(newMsg),
MessageAttributes={
'event_type':{
'DataType':'String', 'StringValue':'something'
}
}
)
return response
它是订阅topicExists
SNS主题的SQS上的Lambda触发器集。你知道吗
问题是SNS主题存在于
us-west-2
区域中,但是您的SNS客户端正在us-east-1
区域中创建。你知道吗此行没有指定区域,因此默认情况下在
us-east-1
中创建:应将其替换为:
相关问题 更多 >
编程相关推荐