0

I need to add 'SNS' based trigger to my Lambda function, But create-event-source-mapping — AWS CLI Command Reference says only DynamoDB, Kinesis, SQS.

The aws lambda create-event-source-mapping command for SNS, S3 etc based triggers fails with --event-source-arn:

An error occurred (InvalidParameterValueException) when calling the CreateEventSourceMapping operation: Unrecognized event source, must be kinesis, dynamodb stream or sqs. Unsupported source arn

However these can be accomplished through AWS console.

Any thoughts?

1
  • What is your actual command which gives the cited error? Commented Mar 13, 2020 at 0:14

2 Answers 2

3

To have a SNS triggers a Lambda, the Lambda need to subscribe the SNS's topic. You can refer to Tutorial: Using AWS Lambda with Amazon Simple Notification Service on getting Lambda triggered when a message published to SNS's topic.

Sign up to request clarification or add additional context in comments.

Comments

0

*the cdk construct lib links provided are in python but you can use a language or your choice

In order to set a sns trigger on Lambda you have do following things, 1) create a SNS Topic 2) create a Lambda function 3) create a Lambda event source 4) integrate all

You can use AWS CDK to do all this Creating a SNS Topic: https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_sns/Topic.html

Creating a Lambda Function https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_lambda/Function.html

Use functuon_obj.add_ecent_source(SNS_obj) to integrate all.

The IAM permissions to invoke your function on sns event will automatically get handled and you see then under Lambda permissions tab on console.

Do mark the answer right if it helps.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.