Deploying .NET 8 aot lambda function to aws from mac

34 views Asked by At

I am unable to deploy a .NET 8 lambda function using aot from my m series mac. I have been following the directions in the documentation here https://docs.aws.amazon.com/lambda/latest/dg/dotnet-native-aot.html but I cannot get it to deploy. The steps work perfectly fine on windows but I get an error when running it on mac.

I run the command dotnet lambda deploy-function and I get the error

Host machine architecture (Arm64) differs from Lambda architecture (X64). Building Native AOT Lambda functions require the host and lambda architectures to match.

The documentation says that the deploy lambda cli command should handle the docker setup but it seems like it's not building it properly. I created my own dockerfiles and specified to use linux-x64 as the target but I still get the same error. What am I missing? Is it really saying that I cannot deploy from my arm computer to aws even when I use docker images?

I have tried creating dockerfiles to make my host environment the same as the target environment but it still throws the error.

1

There are 1 answers

1
Mustafa Güler On BEST ANSWER

You have to specify the architecture that you will use. Could you try to add -farch arm64 option? you can find the options with dotnet lambda deploy-function --help command.