I try to execute an ECS task from a lambda function, the task is created successfully but when the execution starts shortly after the task stops and in Container details
shows a message saying: Exit code: 1
.
When the message ends in the log list it says:
exec /usr/local/bin/python3: exec format error
.
but I don’t understand why, the local image works fine. I try to see if it is a policy or role issue but it doesn’t seem to be the solution.
I don’t think it’s the image because if I run it locally it works, but I’m running out of possibilities.
I’m also trying to see now if it’s an AWS permissions issue.
2
Answers
This means you either deployed an X86 image to an ARM server (like AWS Fargate Graviton), or you deployed an ARM image (like an image built on an M1 Mac) to an X86 server.
Thanks to @mark-b giving me the right answer!
I built a very simple node.js docker image on my M1 Mac, and I tried to deploy via ECS.
He was right. I had to set the runtime platform values correctly. The ECS task keeps stopping with Exit Code 1.
In this doc the value
cpuArchitecture
could be setARM64
. If you built the docker image on M1 Mac, you have to set like that. My issue solved.If you are using the terraform, the code below would be helpful: