Skip to content

Instantly share code, notes, and snippets.

@darakeon
Created March 19, 2025 14:50
Show Gist options
  • Save darakeon/f7671c00402e3f54c9970c7e912fe87a to your computer and use it in GitHub Desktop.
Save darakeon/f7671c00402e3f54c9970c7e912fe87a to your computer and use it in GitHub Desktop.

Running customized container at Lambda

This is the guide was used

I followed the guide to create a project and compared my project to the Lambda one.

The normal programa looks like:

	internal class Program
	{
		static void Main(string[] args)
		{
			/* YOUR CODE */
		}
	}

But lambda program is like:

	public class Function
	{
		private static async Task Main(string[] args)
		{
			Func<string, ILambdaContext, string> handler = FunctionHandler;
			await LambdaBootstrapBuilder.Create(handler, new DefaultLambdaJsonSerializer())
				.Build()
				.RunAsync();
		}

		public static string FunctionHandler(string input, ILambdaContext context)
		{
			/* YOUR CODE */

			return input.ToUpper();
		}
	}

Plus, add these libs to your project:

  • Amazon.Lambda.Core
  • Amazon.Lambda.RuntimeSupport
  • Amazon.Lambda.Serialization.SystemTextJson

And you are good to go! Not need to install the lambda project template or anyhing else!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment