I'm running a fastapi server on ec2 ubuntu. Everything work fine when I ssh in to ec2 and run commands, but I want the server to be running when my local machine is off.
So, I tried AWS System manager's run command. The connection looks fine but when I cd
to the server code and run ls
it outputs nothing. Also, when I do poetry run python main.py
in the server folder, which works totally perfect when I ssh in to the server from my local machine, it says poetry: not found
.
Why is this happening. And is there another way I can run my server while being able to turn off my local machine.
Asked
Active
Viewed 74 times
0

minseokk
- 123
- 3
-
Your ec2 machine does not have your local machine code, you need to push your code from local machine to ec2 machine. – Jatin Mehrotra Sep 05 '22 at 05:50
-
Yes the code is in the ec2 server. I said everything works fine when I "ssh" in to the ec2 from my local. – minseokk Sep 05 '22 at 07:08
1 Answers
0
There is not any kind of relation between your machine and your server in the cloud, and your ec2 its still alive and runs your services whenever you want

Said Gourida
- 26
- 5
-
But if I run server from my local machine by ssh when I kill my local machine the server also dies. – minseokk Sep 05 '22 at 07:09
-
-
-
yes, you just need to run it in the background, if you like make service in Linux and run it always – Said Gourida Sep 10 '22 at 08:40