2 Answers
- Newest
- Most votes
- Most comments
0
https://www.uvicorn.org/#usage
The default interface for uvicorn is 127.0.0.1.
Specify the --host
parameter when starting uvicorn, e.g., uvicorn main:app --port 5000 --host 0.0.0.0
to list on all interfaces
answered 2 years ago
0
The issue you are describing is not related to Security Groups or NACLs. Your connection would time out (as opposed to being rejected) if it were.
Double check if you are requesting the correct IP (public IP of the EC2 in the public subnet) - you can also test with ip a show
on the ec2 console.
You can try to call your running container from your ec2 to check if the docker network is working as expected.
answered 2 years ago
Relevant content
- asked 2 years ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 3 years ago
Thank you @s4zed. I was testing to make api calls from EC2 to my VM. Specifying the
--host
allowed me to make requests from EC2 to my VM. However, making calls from VM to EC2 still throws the same error. There is an image of my security configurations posted at the Stackoverflow question (same questions as here): https://stackoverflow.com/questions/75966975/how-to-open-port-on-ec2-to-allow-api-requests-from-external-ips?noredirect=1#comment133986810_75966975