i have a localstack setup and i can succesfuly publish SNS from my chalice application by poiting the endpoint url like such
_sns_topic = session.resource('sns', endpoint_url='http://localhost:4566')
however one of our endpoints needs to listen to this SNS event in local, but it is currently set-up using @app.on_sns_message()
@app.on_sns_message(topic='topicNameHere', ''))
def onSnsEvent(event) -> None:
#do something
I checked the documentation but i cant seem to find how can I point this so that it will listen to local/localstack events instead.
any tips and/or idea?
I was able to get this running on my side by following the official Chalice docs and using LocalStack's recommended Chalice wrapper. Here are the steps:
localstack start -dawslocal sns create-topic --name my-demo-topic --region us-east-1 --output table | cat(I am usingmy-demo-topic).chalice-local:pip3 install chalice-local.chalice-local new-project chalice-demo-snschalice-demo-sns:chalice-local deployboto3to publish messages on SNS:chalice-local logs -n handle_sns_message