Simplest way to remap HTTP Direct invoke url

HTTP Direct certainly needs no introduction. We’d like to expose an HTTP Direct proxy without exposing consumers to /datomic endpoint URLs.

From what I’ve gathered, there could be a few ways to go about remapping /datomic/* URLs. Using multiple CloudFront origins or Lambda@Edge seem to be options worth exploring.

Does anyone have any experience with this sort of thing or have alternative ideas? Any input would be much appreciated!

I had some more time to poke around with this, so I’ll log what I found for anyone that has a similar curiosity in the future.

It turns out there is no endpoint path imposed or enforced by Datomic, and the /datomic choice in the tutorial is ~arbitrary. As long as the proxy itself and VPC link are configured correctly, it is quite natural to route (e.g. using bidi, pedestal, etc.) to any URL relative to the root, not just those relative to /datomic.

Total oversight on my part, but it’s nice when things are 100x simpler than whatever you’ve built up in your head.

Does this work for Lambda proxies? Or is having a /datomic path a must for web ions which are lambda proxies? I’m looking to create a web app that renders HTML on the server and the /datomic path is a deterrent to deploying the app as an ion.

Hi @ujjwalt,

You can certainly remap Lambda proxies to use other paths—there is no hard dependency on /datomic. The trick is in properly configuring the Lambda integration in API Gateway, which is what specifies URL<=>Lambda association. These are the two resources that helped most when I was initially poking around:

https://docs.datomic.com/cloud/ions/ions-tutorial.html#lambda-proxy
https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html (which is linked from the ion tutorial as well).

-Nolan

My point was - Is it possible to get something on the root path /. I’ll go through the docs you’ve linked but e.g. is it possible (given I have a single lambda ionized as a ring handler) to serve on the root path for my API endpoint?

I believe you can attach request methods to the root with API Gateway, but if you want to use a single ion with its own routing, you’re better off going with HTTP Direct and just proxying everything through to the ion. It will save the cold start time on the Lambda proxy.

I would only use the Lambda proxy if I needed to wire the ion up to another AWS service.

The only catch is that HTTP Direct requires a production topology (or, really, an NLB). If you’re running solo for cost reasons, there’s nothing preventing you from putting your single instance behind an NLB (silly as that might feel).

Which reminds me—I should probably remove the /datomic business from my post and example code. The Datomic docs initially confused me on this point, but as Nolan has pointed out above, there’s no need for a /datomic path prefix.

1 Like