Dash on EC2(Ubuntu 18.04 Server)

Hi All,

I am unable to open the Dash on Chrome Browser. I have Dash installed on EC2 instance and set up port 80 to accept inbound requests. Did anyone face this issue before? Appreciate your help in resolving this.

Here is my code:

import dash

import dash_html_components as html
import dash_core_components as dcc
import pandas as pd
import numpy as np

from dash.dependencies import Input, Output
from plotly import graph_objs as go
from plotly.graph_objs import *
from datetime import datetime as dt

app=dash.Dash()

mapbox_access_token=“pk.”

#create a dataframe for csv file

df1 = pd.read_csv(’/tmp/plot_tree.csv’)
df1.dropna()
print(df1.head(5))

#layout of the app

app.layout=html.Div(children=[
html.H1(“Hello”)
])

if name==“main”:
app.run_server(debug=True, port = 8050, host=“127.0.0.1”)

When I execute this code, the server is running.

[5 rows x 7 columns]

Running on http://127.0.0.1:8050/

Debugger PIN: 125-894-661

But, Browser is like this:

This site can’t be reached

127.0.0.1 refused to connect.

Try:

ERR_CONNECTION_REFUSED

https://127.0.0.1:8050 is only if Dash is running on your local computer. If everything is installed correctly, you’ll need to use the IP address of the EC2 server. For example: http://87.107.63.61:8050/.

1 Like

Hi There…I am hosting on EC2 Ubuntu server. Of course the local host IP will not work, so I have replaced it wit the public IP of the EC2 instance. Yet when I put that in the browser address, I do not see the Dash page.

My security group is open to allow all traffic.

Does any other setting need to be changed for this to work?

Thanks in advance,
shahc

Hmmm, that should work then. Not that I’m aware of.

I’m noting that you mentioned opening port 80 on the EC2 but the example Dash app is running on port 8050. Is this a typo? Have you tried changing the app to use port=80or also unblocking port 8050?

Did you check whether the app is running on localhost before you deploy it on EC2 instance?