I want to use Amazon SNS service
. And I want to have an ability to subscribe an http rest to SNS topic to receive notifications.
However locally my application has URL as localhost
So it's impossible for me to test application behavior locally.
I found one article about using ngrok
server, to use some public IP instead of local.
However it doesn't seem to be a good solution for me.
Do you have any ideas how I could have a working SNS subscriber locally?
I wrote a small library that mimics AWS SNS and I think it fits to your needs. Here is an example of the usage in Java:
I like ngrok but you pay to have a fixed external address, if you want to do it for free you could use a spare email account inbox to send Email-JSON sns. Then an IMAP library to access it, read the emails and pipe the data.
Take a look at one of fake SNS implementations in GitHub, such as s12v/sns:
You could also use ngrok to expose your localhost publicly.
They way it works is it creates a subdomain dynamically and tunnels all request to your machine on the desired port.
Picture this scenario, I have a nginx running on localhost:8080. I open my terminal and run
ngrok 8080
, it will take my terminal session and log my public url, like 'as78fh.ngrok.com'.If I go on another computer, open the browser and navigate to as78fh.ngrok.com/register the request gets served from my localhost:8080/register through the tunnel back to the internet.
I use it for lots of tricky developments, like email webhooks, github integrations and, of course, amazon sns.