Quick example of using AWS Cloudmap to look up APIs by namespace and service name.
The project has two stacks "ping-stack" and "pong-stack". Each stack consists of an API Gateway backed by a Lambda function. The API Gateway endpoint url is registered as a custom attribute of a specific service name ("ping" or "pong") under an AWS Cloud Map HttpNamespace
When a Http GET request is sent to the API gateway the backing lambda will look up the other service using the DiscoverInstances method and make an Http POST to the other api using the url registered with the discovered service. The output is then returned to the user.
npm install
installs dependenciesnpm run build
compile typescript to jscdk deploy --all
deploy the stacks to your default AWS account/region