Service Discovery in Serverless

I have two microservices which are deployed via serverless framework (bunch of lambda’s behind API gateway) . Now microservice A needs to call microservice B 's endpoint. I do not want to hardcode the URL of the API gateway of microservice A. What is the best/recommended way of doing this ?

2 Likes

It looks like Serverless does not support it currently

ref => https://github.com/serverless/serverless/issues/2483

I create DNS entries for internal routes and then put them into environment variables. So:

serviceB:
    handler: ...
    environment:
        serviceA_endpoint: http://example.serviceA.${self:custom.stage}.internal
2 Likes