Cannot connect to streamlit app on ec2 instance via browser

I have been banging my head against a wall trying to get my streamlit app deployed on an ec2 instance so I can share with others, however I am having trouble connecting to my streamlit app via the browser. I noticed that on my local machine I also have the same issue, when I run the streamlit app locally, I am able to access my streamlit app via local host:

http://127.0.0.1:8501/

However the “External URL” and “Network URL” do not work and the page infinitely loads and eventually times out. Here is the external url & network url given by streamlit when you run streamlit run app.py

Collecting usage statistics. To deactivate, set browser.gatherUsageStats to False.


  You can now view your Streamlit app in your browser.

  Network URL: http://<network_ip>:8501
  External URL: http://<external_ip>:8501

I can confirm that I have allowed port 8501 TCP inbound traffic on my local windows machine as well as on the ec2 instance.

Here is my security group config:

EC2 Security Group

How do I make my streamlit application accessible via the given Network URL & External URL by streamlit and not just via localhost:8501?

Would appreciate anyone’s advice who has deployed a streamlit web app on an EC2 instance!

I have checked that:

  • My ec2 instance is listening on TCP port 8501
  • That the streamlit service is running by running “ps aux | grep streamlit”
  • Restarting my instance

A bit of a face-palm moment for me, this issue was a result of my company’s network internal firewall blocking outbound connections to port 8501. Will look to host this streamlit app on a more well-known port so that it’s not blocked by the firewall.

Case closed :slight_smile:

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.