---
title: "Comment by Calvin Butler on \"How to run a highly-available Typesense search in AWS\" | Hashnode"
description: "Hi Stefan, May I ask why you decided to use a SNS Topic with a Lambda subscribed to it? Con: It seems like an extra step because you could just invoked the lamb"
url: "https://hashnode.com/posts/how-to-run-highly-available-typesense-cluster-in-aws/63a1a89aa59cad9bdbba1fe5/comment/655c1cb62a6c065f3be50ed1"
---

[Discussion](https://hashnode.com/posts/how-to-run-highly-available-typesense-cluster-in-aws/63a1a89aa59cad9bdbba1fe5)

Comment [How to run a highly-available Typesense search in AWS](https://hashnode.com/posts/how-to-run-highly-available-typesense-cluster-in-aws/63a1a89aa59cad9bdbba1fe5)

[Calvin Butler](https://hashnode.com/@ckcalbut)

[Nov 21, 2023](https://hashnode.com/posts/how-to-run-highly-available-typesense-cluster-in-aws/63a1a89aa59cad9bdbba1fe5/comment/655c1cb62a6c065f3be50ed1)

Hi Stefan,

May I ask why you decided to use a SNS Topic with a Lambda subscribed to it?

**Con:** It seems like an extra step because you could just invoked the lambda at the end of the UserData script instead of writing to the SNS Topic at the end of the UserData script, which causes the lambda to be invoked.

**Pro:** It does seem cleaner to separate the concerns of the lambda running successfully and the UserData script installing Typesense successfully.

Was this your thinking or am I missing something?

[Calvin Butler](https://hashnode.com/@ckcalbut)

[Nov 21, 2023](https://hashnode.com/posts/how-to-run-highly-available-typesense-cluster-in-aws/63a1a89aa59cad9bdbba1fe5/comment/655c1cb62a6c065f3be50ed1#reply-655c1e86c8bfa45f6b14339f)

Ohhh... I suppose the startup would be tricky without the SNS Topic. The order of creation of things might become a tricky obstacle: The lambda has to be created to be triggered and yet the lambda needs to know some things about the autoscaling group.

[Stefan Olaru](https://hashnode.com/@stefanolaru)

[Nov 21, 2023](https://hashnode.com/posts/how-to-run-highly-available-typesense-cluster-in-aws/63a1a89aa59cad9bdbba1fe5/comment/655c1cb62a6c065f3be50ed1#reply-655c862ac8bfa45f6b144a1f)

Hey [Calvin](https://hashnode.com/@ckcalbut), the SNS topic is in there because the AutoScaling group will publish a message to it in case of EC2\_INSTANCE\_TERMINATE. E.g. in case of a scale-down

[Calvin Butler](https://hashnode.com/@ckcalbut)

[Nov 22, 2023](https://hashnode.com/posts/how-to-run-highly-available-typesense-cluster-in-aws/63a1a89aa59cad9bdbba1fe5/comment/655c1cb62a6c065f3be50ed1#reply-655e4ace356b1a848aa3d7f6)

[Stefan Olaru](https://hashnode.com/@stefanolaru) Ahh that makes sense. Thank you much!
