You'll need to run the demo somewhere publically available, so that AWS can send messages to the app. For example, an EC2 instance or DigitalOcean droplet.
-
Build it with
mvn clean package
-
Copy the jar file from
target/
to the public host -
Run it with
java -jar sns-demo-0.0.1-SNAPSHOT.jar
-
In the SNS console, create a new topic. Call it whatever you want. Copy the ARN for a subsequent step.
-
Create an HTTP subscription using the ARN from above and a URL to your app e.g. http://1.2.3.4/notify.
-
The demo app's logs should show AWS sending a subscription request.
-
Ihe SNS console, with your topic selected, click "Publish to topic".
-
Select "JSON" as the message type.
-
Enter the following in the message box.
{ "default": "{\"foo\": \"bar\"}" }
-
The demo app's logs should show AWS delivering the message and the demo app logging the payload.