I have a Kubernetes cluster with 5 replica sets running a Spring Boot server and I would like to subscribe each pod to an amazon sns topic individually. Is it possible? How can I do that? Thanks!
If you are running a Spring server, you can create an endpoint and mark those endpoints as subscribers to your sns topic. You would need one subscription for each pod (you should be able to get pod address information by running kubectl describe svc ${service_name}
) in order for sns to properly fanout messages to all of your pods. AWS outlines this process here
edit: worth noting the above process is not very robust since that pod address list may not be static. it may be better to subscribe your service to the sns topic, since this abstracts the changing pod IP list, and implement pod-to-pod communication, similar to what is outlined in this article