One of the greatest things about AWS cloud is the AWS Lambda - event-driven service where AWS “runs your code in response to events”. It is a perfect fit for any backend jobs or scheduled tasks.

Unfortunatelly AWS Lambda currently supports code in Node, Python or Java. And it runs on Amazon Linux.

Thankfully, it looks like Microsoft is making .net for a cross platform world. Moreover, it looks like it would be possible to natively compile dotnet applications.

So, even though it looks like C# is not going to be among supported languages on AWS Lambda, we can alway spawn dotnet process from Node or Java.

Let us start with getting dotnet cli. In order to do that i followed step-by-step http://dotnet.github.io/getting-started/. I have created sample console app by simply running dotnet new.

I have edited Program.cs file (note the return 0):

Now, it we have to natively compile application:

You can find executable in /bin/{Configuration}/dnxcore50/native/{appname}

Now we need node.js code to spawn external process. I may look more or less like that:

Call it index.js and zip it with executable.

Now, create new aws lamda and uploading zip with those 2 file.

And running test:

This really makes me smile :)