Here providing you a general picture of how to do it,
First, create the topic and subscribe to some endpoints to receive messages and after you subscribed endpoint to the topic then an endpoint would receive a "Subscription Confirmation" message.
Then start to publish to the topic so that your endpoint will receive the notification messages.
Now on the subscriber's side,
Confirm subscription, make the HTTP GET request to the "SubscribeURL" URL which comes with the confirm subscription request.
So before you confirm the subscription, the endpoint will not receive any messages from SNS.
Once, done you would receive notification messages and can do what you want.
You can refer to the AWS documentation here for more details.
Want to learn more about AWS, then do check out AWS Course offered by Intellipaat.