Use AWS SNS to send data to Tinybird
SNS is a popular pub/sub messaging system for AWS users. Here's how to use SNS to send data to Tinybird.
![Use AWS SNS to send data to Tinybird](/content/images/size/w2000/2023/09/631696b27909426770f293d6_62c713978c9dd7e8dad6f22b_sns_968x664-4.png)
If you operate on AWS infrastructure, AWS’s Simple Notification Service (SNS) provides a simple managed service for pub/sub messaging to various AWS and external services.
Given that a lot of Tinybird customers operate on AWS, SNS tends to be one of our most requested data origins. It provides an easy-to-use path to distribute messages to multiple destinations, allows for message filtering, and has built in data-loss prevention mechanisms. Because it’s a tool our customers regularly use and like, we’ve prioritized making it possible to connect SNS to Tinybird.
And now, we are happy to say that we can support data ingestion from SNS! We’ve conditionally rolled it out for all customers and are opening up the feature to feedback. If you have any, please share it with us in our community Slack.
How to use SNS to send data to Tinybird
Here’s how to use AWS SNS to send data to Tinybird:
Step 1: Use an existing SNS topic or create a new one
From your AWS console, navigate to an existing SNS topic or create a new one.
![A webpage showing how to create an SNS topic to send data to Tinybird](https://tinybird-blog.ghost.io/content/images/2023/09/62c70d490005ce12c678d3aa_U1HFi4yHfXskX8WrRlka7Q98ehqnqNklWh41xllFFeustgbGvCKSi70NpUDuHXke5XcAKrZEC8gFzYSmLzFM_VaRgLi30o8VHfv-14fn1pN3Tju4ZG0y8HAmSFnNnlSq4xlGfIsN-hwC9m5P-Q-10.png)
Step 2: Create a new subscription for the topic
Define a new subscription using the Tinybird /events
API endpoint as the subscription Endpoint using the following syntax:
https://api.tinybird.co/v0/events?name=YOUR_DATA_SOURCE_NAME&token=YOUR_TOKEN
Make sure to select HTTPS as the protocol and check “Enable Raw Message Delivery”, then click “Create Subscription.”
![A webpage showing how to create a subscription from AWS SNS to the Tinybird /events endpoint](https://tinybird-blog.ghost.io/content/images/2023/09/62c70d4a021cd66894de3620_VASXjak4DrN1hP8rPHwQM07_OQhjHBINy1rGdLZ8LbIl1L10TILe3AD6etyPFlcRs3wLBZqr8rQLZ2JsQmBbS2jFpsfNVF8KbKDAoWxZ8SEmqg1GIHTOhgTD1Thoh0JagX1-Xwq41iydBZmlcQ-11.png)
You should see a confirmation screen like the one below.
![AWS SNS confirmation screen](https://tinybird-blog.ghost.io/content/images/2023/09/62c70d4acdcc219a7e633a48_lTlsZ1MHTtjxiiE528jSeKCPLbpDbER6w7bv3v1lhmbTvwFhVEwU9LxwlpHzB7zRs5QuD5_Yz0O5vfwP2z65cWoGNbL8iRSAq3J0e2fS0ny0Ejv2tg8I_4UStvkH67yWgwwdBX_4pPN7rqoPtg-11.png)
Step 3. Start sending messages to your SNS topic
You can manually publish messages to your new SNS topic from the topic page by clicking “Publish Message”
![A webpage showing how to publish a message to an SNS topic.](https://tinybird-blog.ghost.io/content/images/2023/09/62c70d4a1f75d98741baf0c7_sG2OOBEugXESvYdi2d_oIQZ21SDrdYzecnN8wcq7m6zxMvtwgqZExztPRYdVhsRKkut2JDunXXAygHdrkSun0yz75-B92YiwiaU9ZtkmfOR1XQQO-fZZqpcgwdaOwcnCEzqr_7r7HfNUxXtDhg-11.png)
Just define the JSON payload to be sent in the Message Body section
![A webpage to publish a message to an SNS topic showing the JSON message structure](https://tinybird-blog.ghost.io/content/images/2023/09/62c70d4afd84384d203947dc_vN_p1StGN2RhY4c6rHyfYsTj7ZMaB6Gl6DlgSBti14mIJS4wBxCxVSupk4AR0fW11eJUnzUdVdq-WRWGLW5-9LMZDav7dHRTuAEc11Zx4dQZbW3eg_fh0GzwqHn8hjxyLKWie7KiH7S76YfRDA-11.png)
You should see data appear in your Tinybird data source.
![A Tinybird data source](https://tinybird-blog.ghost.io/content/images/2023/09/62c70d4ae1a47920dd29fb29_ktrXRZqjJ3m0-vj1rU_XvmZS-ULU1MEF0OnRp8uy8XgZmbPh3usdo6RrVJJZvRS214e-IztY4E2bRtlsdPYlBba-eULJihnVOgNNq3DciyoQFqNIXRjYE6vaTMzjdd7IGWu6Zrhh0Sy1-xZC7w-11.png)
Here’s a bit of JavaScript showing how to publish a new message to the SNS topic. Just replace your AWS region and Topic ARN in the code.
As always, if you have any questions or run into issues, you can join our Slack community.