Publish message from SNS to kinesis

user3462649 picture user3462649 · May 21, 2018 · Viewed 8.4k times · Source

I have requirement to publish messages from SNS to kinesis. I have found that, it is not possible directly by subscribing same as SNS/SQS. I will need to write lambda to fetch from SNS and publish it to kinesis. Is there any other way to publish records from SNS to kinesis directly? Thanks

Answer

John Rotenstein picture John Rotenstein · May 22, 2018

Amazon SNS is a publish/subscribe model.

Messages sent to SNS can be subscribed from:

  • http/s: delivery of JSON-encoded message via HTTP POST
  • email: delivery of message via SMTP
  • email-json: delivery of JSON-encoded message via SMTP
  • sms: delivery of message via SMS
  • sqs: delivery of JSON-encoded message to an Amazon SQS queue
  • application: delivery of JSON-encoded message to an EndpointArn for a mobile app and device.
  • lambda: delivery of JSON-encoded message to an AWS Lambda function.

See: Subscribe - Amazon Simple Notification Service

Of these, the only ones that could be used to send to Amazon Kinesis would be to use AWS Lambda. You would need to write a Lambda function that would send the message to a Kinesis stream.

To clarify: Your Lambda function will not "fetch from SNS". Rather, the Lambda function will be triggered by SNS, with the message being passed as input. Your Lambda function will then need to send the message to Kinesis.

Your only other alternative is to change the system that currently sends the message to SNS and have it send the message to Kinesis instead.