Local AWS Lambda hosting in Aspire #5692
Kralizek
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
I wish I had something like this when I worked with lambdas :) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The juicy bits first.
I was working on this before the summer. In the last couple of days I decided to take the different tests I wrote back then and publish in a nice soon-to-be NuGet package.
Behind the scenes, I use the same code used for YARP to host in memory a ASP.NET Core application. The application has a single endpoint that matches the AWS API to invoke a function execution via their SDKs. The endpoint plays some crazy (and quite dirty, truth to be told) reflection tricks to instantiate and execute the function. The reflection stuff would be so much nicer/easier/neat if aws/aws-lambda-dotnet#1760 were to be solved.
Right now I support only function created with Annotation framework, but ideally classic function programming models would be supported.
What else? Oh, the most important thing! The calling application will never know anything about Aspire hosting. The
WithReference
extension used in the snippet above is a custom one setting the SDK local endpoint to the in-memory web app address.Here is the link to the repository: https://github.com/Kralizek/dotnet-aspire-lambda-hosting
Beta Was this translation helpful? Give feedback.
All reactions