Reputation: 13571
I have an AWS lambda function that triggers an SNS topic on failure.
I'm wondering why the SNS topic is not triggered why I run "Test" in the AWS console.
As you can see in the above picture, the python lambda function raises an error at line 4.
I've subscribed to the SNS topic with my e-mail address. And I have clicked the "Confirm subscription" link. So there should be no problem receiving messages from the SNS topic.
I've also confirmed that the role of my AWS lambda function has "AmazonSNSFullAccess" permission.
Why can't I trigger SNS topic through the "Test" in AWS lambda function?
Upvotes: 0
Views: 1061
Reputation: 13571
Thanks to pyzor's information, I use the following python script to asynchronously trigger my AWS lambda function so that it can send messages to SNS topic.
import boto3
client = boto3.client('lambda')
response = client.invoke(
FunctionName='my-function',
InvocationType='Event'
)
print(f"response: {response}")
Upvotes: 1