mahemoff
mahemoff

Reputation: 46509

AWS: Saving every SNS message

What's the easiest way to save/log every message published on a AWS SNS topic? I thought there might be a magic setting to automatically push them to S3 or a database, or maybe a database service supporting the HTTP destination automatically, but doesn't seem to be the case. Maybe it needs to be done via a Lambda function?

The purpose is just for basic diagnostics and debugging while setting up some SNS publishing. I don't really care about high scale or fast querying, just want to log and perform basic queries on all the activity for a few minutes at a time.

Upvotes: 3

Views: 3330

Answers (2)

jsallaberry
jsallaberry

Reputation: 318

According to the docs, SNS can publish to:

http – delivery of JSON-encoded message via HTTP POST
https – delivery of JSON-encoded message via HTTPS 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.

So yes, a simple approach would be to trigger a lambda function to write to S3 or CloudWatch.

Upvotes: 0

Asdfg
Asdfg

Reputation: 12253

You can setup a trigger to push your SNS messages to SQS queue. Push is automatic and does not require any code.

Upvotes: 1

Related Questions