testapps/TestNativeAotSingleProject/Function.cs (18 lines of code) (raw):

using Amazon.Lambda.Core; using Amazon.Lambda.RuntimeSupport; using Amazon.Lambda.Serialization.SystemTextJson; namespace NativeAotTest; public class Function { /// <summary> /// The main entry point for the custom runtime. /// </summary> /// <param name="args"></param> private static async Task Main(string[] args) { Func<string, ILambdaContext, string> handler = FunctionHandler; await LambdaBootstrapBuilder.Create(handler, new DefaultLambdaJsonSerializer()) .Build() .RunAsync(); } /// <summary> /// A simple function that takes a string and does a ToUpper /// /// To use this handler to respond to an AWS event, reference the appropriate package from /// https://github.com/aws/aws-lambda-dotnet#events /// and change the string input parameter to the desired event type. /// </summary> /// <param name="input"></param> /// <param name="context"></param> /// <returns></returns> public static string FunctionHandler(string input, ILambdaContext context) { return input.ToUpper(); } }