Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amazon.Lambda.AspNetCoreServer with Application Load Balancer #350

Closed
ryanpagel opened this issue Dec 2, 2018 · 20 comments
Closed

Amazon.Lambda.AspNetCoreServer with Application Load Balancer #350

ryanpagel opened this issue Dec 2, 2018 · 20 comments
Labels
feature-request A feature should be added or improved.

Comments

@ryanpagel
Copy link

Does the Amazon.Lambda.AspNetCoreServer work with the Application Load Balancer integration that was just announced during reInvent? I'm noticing some strange behavior when trying this out, not sure if I'm doing something wrong or if it's a known issue.

@normj
Copy link
Member

normj commented Dec 3, 2018

I was just taking a look at the new ALB integration. The JSON request that gets sent into the Lambda function is a different than API Gateway. It shouldn't be too hard to detect in APIGatewayProxyFunction the JSON format and do a different parse logic based on the source.

@ryanpagel
Copy link
Author

That would be great. We would probably use the ALB as our preferred method of integrating since we already make heavy use of ALB.

@thorgod
Copy link

thorgod commented Dec 11, 2018

We are currently using APIGatewayProxyFunction, but the API Gateway only allows 30 seconds to finish transaction. A ELB would be a good work around for our larger data that needs processing. (Up to the limit on lambda functions 15min)

It would be amazing if we could just use the LambdaEntryPoint : Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFunction and have it not care if its APIGateway or a ELB.

@normj
Copy link
Member

normj commented Dec 11, 2018

I have been working on the ALB support on the alb-support branch. The next step in that branch is working on Amazon.Lambda.AspNetCoreServer

@thorgod
Copy link

thorgod commented Dec 11, 2018

Wow that was quick! =) Thanks!
Cant wait!

@jbright
Copy link

jbright commented Dec 12, 2018

This is great, thanks. Looking forward to using this for our dotnet core web app. Thanks!

@pnquest
Copy link

pnquest commented Dec 12, 2018

Agreed, can't wait for this feature!

@normj
Copy link
Member

normj commented Dec 13, 2018

Status update I have pushed the branch alb-support-aspnetcore which contains the updates for Amazon.Lambda.AspNetCoreServer.

The changes ended up triggering a bigger refactor then I had hopped. I had definitely not anticipated when I originally wrote this library that there would be multiple HTTP frontends for Lambda functions.

If anybody is willing to clone the repo and give this a try while I finish with validation that would be great. You should just need to clone the repo, go into Amazon.Lambda.ApplicationLoadBalancerEvents and Amazon.Lambda.AspNetCoreServer and do a dotnet pack. Then add the created NuGet package to a local feed.

For most apps the only change you should have to do in LambdaEntryPoint or whatever you named it is change the base class from APIGatewayProxyFunction to ApplicationLoadBalancerFunction.

@thorgod
Copy link

thorgod commented Dec 13, 2018

Funny thing is I re-deployed to a LAMBDA name using master, and I was able to use ELB with LambdaEntryPoint : Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFunction before your branch, and everything worked. (Just need to set the rules on the ELB Trigger to use path "api/*")

(Somehow setting up a ELB trigger on new lambda function works out the gate without your branches, maybe because the headers/responses are close to the same.)

If I have time I will test out your branch later today.

@normj
Copy link
Member

normj commented Dec 13, 2018

There is a fair amount of similarity between the API Gateway and ALB event which can allow you to get lucky. If you enabled multi value headers or had binary data from the request body it would fail.

@thorgod
Copy link

thorgod commented Jan 2, 2019

Branch looks good.

@diehlaws diehlaws added feature-request A feature should be added or improved. and removed Enhancement labels Jan 3, 2019
@skhati1
Copy link

skhati1 commented Jan 11, 2019

This looks terrific! I'm eager to see how this functionality works in action. Do we have any estimated ETA on when this can be merged and packaged up?

@ThomasHjorslevFcn
Copy link

Really looking forward to seeing this in the official package.
I think this is the best serverless offering that you have. We would migrate most of our APIs and even web sites to this if not for the two major drawbacks being; API Gateway and the (lambda) cold start delays. This fixes one of them, and ALB health checks should help to keep lambdas alive :-)

@pnquest
Copy link

pnquest commented Feb 5, 2019

@normj, just curious if there is any ETA on when we can expect this to be available on Nuget?

@signityvivek
Copy link

I am eagerly waiting for this feature to be included in the Nuget too.

@Sumo-MBryant
Copy link
Contributor

I have tested this on my already existing application and it appears to work without issue.

@normj
Copy link
Member

normj commented Feb 7, 2019

Version 3.0.0 of Amazon.Lambda.AspNetCoreServer was released today with ALB support. Check out the blog post for more information. https://aws.amazon.com/blogs/developer/updates-for-serverless-asp-net-core/

@ryanpagel
Copy link
Author

@normj Great post and excellent work! Thanks for all you do to integrate .NET into the AWS ecosystem.

@normj
Copy link
Member

normj commented Feb 8, 2019

@ryanpagel Your welcome 😄

@normj
Copy link
Member

normj commented Feb 13, 2019

Closing as the feature is released.

@normj normj closed this as completed Feb 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

10 participants