Fork me on GitHub
#aws
<
2018-05-16
>
juliobarros16:05:49

Anyone have a strategy/framework for developing a Clojure lambda function behind api-gateway that can also be developed/tested/used locally more like a regular ring function?

richiardiandrea16:05:51

@juliobarros I started to use terraform with a swagger template that is built manually atm...one could actually do it directly from spec 😉

juliobarros16:05:47

@richiardiandrea is that to specify the api gateway swagger? I’m using the proxy with a more command/query approach not to REST-ish so my question is more basic. I’d love something to translate a ring request into a lambda context (or the other way around) so that I can run my function locally to test and develop the front end cljs app.

richiardiandrea16:05:08

@juliobarros I think AWS allows it yes, you need to use their "extensions" though, so for instance I had to do this:

richiardiandrea16:05:06

"/query-events": {
      "post": {
        "tags": [
          "Events"
        ],
        ...
        "x-amazon-apigateway-integration": {
          "httpMethod": "POST",
          "requestParameters": "body",
          "type": "aws_proxy",
          "uri": "arn:aws:apigateway:${aws_region}:lambda:path/2015-03-31/functions/arn:aws:lambda:${aws_region}:${aws_account_id}:function:${query_events_function_name}/invocations"
        }

juliobarros16:05:13

Ok. Thanks. Its been a while since I looked at this, I’m considering it for a new project, and I’ll need to refresh my understanding. Thanks again.

richiardiandrea17:05:23

yeah, I am writing it manually now but it could be generated

richiardiandrea17:05:10

I have this as a swagger template at the moment and I don't have many lambdas, so I haven't had the need for automation