0

I'm new in AWS but have already tried to compose and deploy simple .NET Core 2.0 application.

I have .Net 4.6 application which uses external c++ dll. The last one hase it own huge number of dependencies - over 300 MB of other dlls. So I try to deploy those stuff on AWS using Lambda.

At first I've created simple AWS Lambda Project and tried to code logic on following method

public async Task<string> FunctionHandler(S3Event evnt, ILambdaContext context) { ... }

But during deployment I've got error - it allows to deploy just ~65MB of content with Lambda.

Later I've created AWS Serverless Application - it was much better because of possibility of WebAPI using (it would be useful to use it in future for me). I've started to create logic in public class LambdaEntryPoint : Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFunction class, adding the handler function: public async Task<string> FunctionHandlerAsync(JObject param, ILambdaContext context) { ... }

The first trouble was JObject - it was awful to parse it to get Bucket and Object key. And still it was the limitation of deployment content - already ~250MB. The fix was done - I've got all dependencies and .exe file into the .zip and unzipped it to the \tmp folder during the LambdaEntryPoint initialization. That was right and without issues. But later I tried to launch an .exe file using the following code:

 var process = new System.Diagnostics.Process();
        process.StartInfo.FileName = "Photolemur Console.exe";
        process.StartInfo.WorkingDirectory = @"\tmp";
        process.StartInfo.Arguments = $"\"{inboxPath}\" \"{outboxPath}\"";
        process.Start();

        process.WaitForExit();

And I've got FileNotFound Exception. So the question is below -

Is it possible to do such thing using AWS lambda functions? I know that I could rise EC2 with virtual Window installation. But is it right way? What do you think about AWS .NET in general? Should I continue my researching or maybe it's easier way to explore Microsoft Azure Functions?

PS: Is it some nice solutions to do such work using just my C++ libraries at AWS?

1 Answers1

0

This is IMO not worth the effort. Lambda functions are executing in Linux containers, therefore running Windows .exe would require Wine, which is possible, but painful and further increases size of lambda application and you could quickly run out of space in /tmp (512MB).

Also size limit for lambda application (50MB) exists for a reason: it allows AWS infrastructure to quickly scale number of instances up and down as needed. Circumventing this limitation ruins this advantage of AWS lambda.

I do not know scaling/latency/usage needs of your application, but using regular EC2 instance(s) seems to me to be better fit. Instances with performance comparable with AWS Lambda are quite cheap so the only drawback is that you have to manage them yourself.

Ňuf
  • 6,027
  • 2
  • 23
  • 26