xxgreg / connect_grpc_lambda_experiment

Experiment at creating a binary which can run either as an AWS Lambda or a GRPC server using the connect go GRPC over HTTP protocol.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Connect GRPC Service + AWS Lambda

An of example of how run a connect go GRPC Service on AWS Lambda. Only unary connect protocol requests are supported.

In theory binary protocol should work, but I haven't tested it.

To configure this you need to create an Rest API Gateway. Set up the root resource as proxy and use "Lambda Proxy integration".

API Gateway handles an incoming HTTP request and translates it to a JSON message, which is used to invoke the Lambda. The Lambda translates the JSON message back into a Go net/http HttpRequest object. This HTTP request is given to the connect HTTP handler, and the response is buffered, and converted into the JSON format expected by API Gateway Lambda Proxy integration.

Since the connect GRPC protocol is simple enough, this should just work™ for unary requests. Well at least that's the theory.

More Exploration...

I haven't looked into it, but using this new Lambda feature it should also be possible to support streaming responses.

https://aws.amazon.com/blogs/compute/introducing-aws-lambda-response-streaming/

About

Experiment at creating a binary which can run either as an AWS Lambda or a GRPC server using the connect go GRPC over HTTP protocol.

License:Apache License 2.0


Languages

Language:Go 100.0%