Streamlit AWS EC2 giving "Site can't be reached"

Hello,

I tried deploying my streamlit code on aws and it doesn’t run even after adding port 8051 in my inbound rule and restarting the instance. I tried running the command streamlit run myFileName.py and it gave me the following message:
Collecting usage statistics. To deactivate, set browser.gatherUsageStats to False.

  You can now view your Streamlit app in your browser.

  Network URL: http://x.x.x.x:8501
  External URL: http://x.x.x.x:8501

But clicking on it give me this:

Any help is appreciated!