# Cannot connect to streamlit app on ec2 instance via browser

**URL:** <https://discuss.streamlit.io/t/cannot-connect-to-streamlit-app-on-ec2-instance-via-browser/37161>\
**Category:** Deployment\
**Created:** [February 5, 2023, 2:06pm UTC](https://discuss.streamlit.io/t/cannot-connect-to-streamlit-app-on-ec2-instance-via-browser/37161 "2023-02-05T14:06:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jakeoliverlee](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/jakeoliverlee/32/22598_2.png) [@jakeoliverlee](https://discuss.streamlit.io/u/jakeoliverlee)\
**Post date:** [February 5, 2023, 2:06pm UTC](https://discuss.streamlit.io/t/cannot-connect-to-streamlit-app-on-ec2-instance-via-browser/37161/1 "2023-02-05T14:06:08Z")

</div>

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`

```auto
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](https://i.stack.imgur.com/s7uvS.png)

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

---

<div class="post-metadata">

**Author:** ![jakeoliverlee](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/jakeoliverlee/32/22598_2.png) [@jakeoliverlee](https://discuss.streamlit.io/u/jakeoliverlee)\
**Post date:** [February 7, 2023, 12:56pm UTC](https://discuss.streamlit.io/t/cannot-connect-to-streamlit-app-on-ec2-instance-via-browser/37161/2 "2023-02-07T12:56:27Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/streamlit/original/3X/c/f/cf4c2ee0d938358f82448c5fe4b9c3c91d7ce19c.svg) [@system](https://discuss.streamlit.io/u/system)\
**Post date:** [February 7, 2024, 12:56pm UTC](https://discuss.streamlit.io/t/cannot-connect-to-streamlit-app-on-ec2-instance-via-browser/37161/3 "2024-02-07T12:56:35Z")

</div>

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