For programmers, testers and tech geeks

What is AWS Lambda ? How to setup and implement AWS Lambda for .Net Core ?

AWS Lambda is serverless architecture by Amazon which provides computing platform which means we don't need to be worry about the computing resources. It is a function which acts as computing service, take input process it ( which is your written code ). Its available since November 2014. By Amazon “Run code without thinking about servers. Pay only for compute time you consume”. Just for information Firecracker is the underlying technology that powers AWS Lambda.

As real example, Lambda is a function with is attached with a trigger and runs and perform its functionality once called by other service. Think of a file storage service lets say Amazon's S3 service. We want that when there is any new image placed on S3 then a lambda function get triggered and resize / compress / optimize that image and place new processed image with different name in the same S3 bucket location. There are some other scenarios list here on Amazon's official page.

Alright guys enough talking, let's dig into Lambda usage in real example. In that scenario we have same S3 but instead of images we have videos associated with S3 put request to trigger our lambda function once a video is successfully placed. Lambda function will create three different quality formats for same video and will place in the same s3 bucket location.

From implementation point of view I started with visual studio 2017. I first installed AWS toolkit for visual studio from here : https://aws.amazon.com/visualstudio/ the download for Visual Studio 2017 redirected me to   https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.AWSToolkitforVisualStudio2017 where I downloaded and installed the toolkit. After installation visual studio started to giving me AWS Explorer tab.

 

AWS Explorer

 When I click on this explorer I am given list of options including AWS Lambda

AWS Lambda

Which means AWS toolkit has been installed successfully. So to create AWS Lambda function I go to File -> New Project . And on that window I am shown AWS Lambda option.

 

 

AWS Explorer

I clicked AWS Lambda Project and a Blueprint window opened with template projects so I selected empty project and a new project has been created with default Function.cs file with an empty function handler method.

AWS Explorer

 

AWS Explorer

 That's it guys, that was simple and brief intro to Lambda, AWS SDK for .net and default template of Lambda function. In next post we will so how to publish and consume a Lambda function.