I'm able to SSH into my EC2 instance without any problems, and my Docker container with a FastAPI app is running smoothly (I get a response when I curl localhost:8000). The Docker container is set to publish on 0.0.0.0:8000. I have a public IPv4 address assigned and my security group is configured to allow inbound traffic. I've also checked the Network Access Control List (NACL) and confirmed that the allow rules are above the deny rules. There's no OS firewall blocking access. However, every time I try to access either http://public_ip/ or http://public_ip:8000/, I get a timeout error. This happens even when there's no container or app running, and I've tested it with different ISPs and IP addresses, so I'm sure it's not an ISP issue.
I did a network path analysis and it seems to work fine from the network gateway to the EC2 instance. But when I try accessing port 8000 of the public address, it fails without providing much detail about the error.
3 Answers
Have you tried accessing it using HTTPS instead? Sometimes browsers may block HTTP traffic depending on security settings.
It sounds like a security group issue. Double-check that your security group allows connections to port 8000 from 0.0.0.0/0. If you haven't already, consider setting up an Nginx reverse proxy to reroute requests from ports 80 and 443 to your Docker container's port 8000.
Since you mentioned reviewing the NACL, keep in mind that if it's a non-default NACL, make sure you allow high-port ephemeral transit. This is particularly important for non-root services like your Docker containers.”},{

Related Questions
How to Build a Custom GPT Journalist That Posts Directly to WordPress
Cloudflare Origin SSL Certificate Setup Guide
How To Effectively Monetize A Site With Ads