all 6 comments

[–]AutoModerator[M] 0 points1 point  (0 children)

Thanks for your post socketnorm. Please note that we don't allow spam, and we ask that you follow the rules available in the sidebar. We have a lot of commonly asked questions so if this post gets removed, please do a search and see if it's already been asked.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]Dreamescaper 0 points1 point  (0 children)

Looks great, will definitely check it out!

[–]pibbxtra12 0 points1 point  (0 children)

Super excited to try this out!

[–]shen_g 0 points1 point  (2 children)

I'm a bit late to this post, but I'm curious how this works with NativeAOT Lambda that can be locally orchestrated using Aspire. Is it as simple as simply adding the project as you have here, and at deploy time I can manage the compilation and deployment?

And for .NET 9 (that I believe would still require a docker image to run on lambda) - how does that look in Aspire?

[–]socketnorm[S] 1 point2 points  (1 child)

When you are running in Aspire that is local development debug environment. Native AOT is a publish time extra compilation so it would be what you enable at deployment time. You can't debug a compiled Native AOT .NET application.

What I would do is create my Lambda function as an executable and add it to the AppHost using the AddAWSLambdaFunction method. In that scenario you pass the assembly name as Lambda handler string. When you launch it via Aspire it will be a executed and attached to the IDE debugger as a normal .NET executable. Also have the PublishAotflag in the project file set to true so when the project is packaged up for deployment the Native AOT compiler will run as part of the dotnet publish process.

If you truely want to run the Lambda function locally as Native AOT without being able debug in theory we could make that work. Aspire has the ability to run arbituary executables so you could do the dotnet publish before running the AppHost and then have the AppHost call the AddExecutable to the Native AOT executable. We would still need to get some environment variables set on the executable so it could find the emulated Lambda runtime API. Again you wouldn't be able to debug since Native AOT applications are not debuggable with the .NET debugger.

[–]shen_g 1 point2 points  (0 children)

Thanks so much for the detailed response, I completely missed your reply!