0

I dockerized 99% of my application and 99% of it works on linux. One part requires loading some exe file. I was think about using aws lambda just for this. So docker image on amazon linux machines, small cost and all other benefits and all of the sudden I found that out - AWS Lambda is run only on linux . What is best way to achive that my app run on linux docker images and one small part of it run on windows operating system

EDIT One comment bellow suggested starting new EC2 instance but fast feedback to user is needed here since. So feature is related to UI where user clicks something and on server calculation is made and response returned to user.

Vlado Pandžić
  • 4,879
  • 8
  • 44
  • 75
  • 3
    Well, is your serverless function specific to Windows? And if so, how? – Julia Mar 08 '21 at 23:03
  • What is this "small exe file"? What does it do? Do you own the source code? – Daniel Mann Mar 08 '21 at 23:04
  • Well, yes. I own source code. It is some. Net wrapper around cpp code – Vlado Pandžić Mar 08 '21 at 23:23
  • Basically my aws lambda should reference some project I have. That project has method which amongs other calls exe file to make some calculation. And this is only thing left to be platform agnostic. I tought lambda would be ideal fit but ofcourse only linux.it is redicoulous to have windows machine running for only one method that will be run once in a day or so I guess – Vlado Pandžić Mar 08 '21 at 23:31
  • I see three possibilities: (1) have a "normal" Lambda and a Windows docker Lambda. The normal one calls the Windows one with your code. (2) Port your Windows code to Linux with some portable language and (3) Have your Lambda code startup a Windows EC2, run the code, and stop it during the run. – stdunbar Mar 09 '21 at 01:23
  • @stdunbar Regarding option 1. Are there exist Windows lamda? And regarding option 3.) Will it be slow to start EC2 instance because it is necessary once user clicks button on UI to get response within few seconds? I am not sure how fast it will be process of go to my server, then to amazon lambda then start EC2 then execute code, then return response – Vlado Pandžić Mar 09 '21 at 08:10
  • @VladoPandžić - my apologies but I was wrong that you could run a Windows Docker on Lambda. You can only run Dockers with the same O/S as the host O/S. So option (1) is not viable. And I didn't know that this was a UI based thing. There is no way that (3) would be fast enough - startups take a few minutes. So unless your code can use the [.net Lambda](https://aws.amazon.com/blogs/compute/developing-net-core-aws-lambda-functions/) or can be ported to something cross platform Lambda may not be the right choice. – stdunbar Mar 09 '21 at 20:40
  • @stdunbar yes, I am dissapointed that I will have to use windows machine (because I dont know what else) because of 0.01% of the app (but important feature) – Vlado Pandžić Mar 09 '21 at 21:30
  • Can you start a new thread to see if there is a way to convert the code? Perhaps that would be the way to go. – stdunbar Mar 09 '21 at 21:42
  • @VladoPandžić - have you looked at [Azure Functions](https://learn.microsoft.com/en-us/azure/azure-functions/)? They have .net and C# environments and the concept is the same as Lambda. As you're Windows based it may be a better solution. – stdunbar Mar 10 '21 at 16:37
  • So I will now have two clouds? AWS (most of it alredy in company) and azure also – Vlado Pandžić Mar 10 '21 at 17:34

3 Answers3

4

One possible solution to this might be to run the exe with wine. This avoids needing to convert the code to run natively, but still allows those windows-specific parts of the application to execute in a linux environment, like that provided by AWS Lambda.

1

No, you cannot run a Windows AWS Lambda. For a list of the supported runtime environments, see here, they're all based on linux.

As Geno said, you may be able to use wine. But I would add that while possible, it's not really practical. I know because I've done it. See my answer to this question here.

If you own the source and it doesn't have a lot of dependencies, that makes it easier, but it is still hard.

poida
  • 3,403
  • 26
  • 26
0

You can try to run windows on docker https://hub.docker.com/_/microsoft-windows-base-os-images or you might use wine to run it on linux