• What is AWS Lambda?

    AWS lambda is the serverless compute service provided by Amazon. You can use AWS lambda to run small piece of code that need to executed repeatedly without taking care of server resource allocation.

    You pay per execution and get a million executions per month for free without having to worry about server provision and maintenance. It can expand when needed and scales automatically, from few requests per day to thousands per second. You can create AWS lambda service using Node JS, Java, Python or C#. This article focus on how to create AWS lambda function using c#.

    Let’s get started

    AWS lambda function works on .Net Core 1.0 and .Net Core 2.1 so you need Visual Studio 2017 to create AWS function.

    Step 1 : Download and Install AWS Toolkit for Visual Studio 2017 from the link https://aws.amazon.com/visualstudio/

    Step 2: Open the visual studio and create new AWS Lambda Project (.NET Core C#) as shown in screenshot.

    Step 3: Select Blueprint as Empty Function and click on Finish button.

    It will create project structure as shown in the below screenshot.

    Step 4 : Open the Function.cs file and here you can write the code. Code for Function.cs is shown in the below figure.

    Main components of the code are

    1. Function Handler- It is entry point of AWS lambda function.

    2. String input - It is input to the lambda function which can be passed when AWS lambda function is called. You can also pass JSON object as input to lambda function.

    3. ILambdaContext context - It contains some use full information like function name, memory details, timeout details etc.

    4. You can also do logging and error handling in AWS lambda function using Log method of Amazon.Lambda.Core.LambdaLogger class. You can see the log in AWS lambda console of lambda function.

    Note: In the next article, I will explain how to configure and deploy AWS lambda function.

0 Years in
0 Loyal
0 Successful

Words from our clients


Tell Us About Your Project

We’ve done lot’s of work, Let’s Check some from here