Score:0

AWS HTTP Gateway: private integration routing without path variables

kr flag

I've been setting up an HTTP gateway for the first time and came across an issue with private integrations. I want all my integrations to be private but it doesn't work well with routing.

I have a private integration with a $default route and it works great. Now I want another private integration to be mounted under, say, /microservice/ and have all its endpoints proxied.

This however seems impossible because private integrations ask you for a backend ARN rather than URI, so there's no way to use path variables like {proxy+}. This results in only root of my microservice being accessible through the gateway - all the other paths just go to the $default route.

How would one go about setting up a private integration like this? Ideally I would like something like this:

- /microservice1/{proxy+}
- /microservice2/{proxy+}
- $default

Currently as I understand it I only have two options:

  • Expose my services to the world and use public integration with greedy path variables {proxy+} - not ideal
  • Keep the private integration but define each microservice endpoint as it's own route on the gateway - extremely annoying to maintain

Is there a good way to do this that I'm missing?

Score:0
kr flag

To answer my own question - this is possible with request parameter mapping that transforms request before it reaches the backend:

  1. Create a route with greedy path variable: /microservice/${proxy}
  2. In your private integration create a path mapping: overwrite:path = /$request.path.proxy
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.