Streamlit EC2

Hi!

I have deployed a streamlit app and hosted it on an ec2 instance. I would love to have the app to start every time I start the ec2 instance (instead of ssh and “streamlit run myapp.py”)

Has anyone ever done that ? I tried to change the crontab on ubuntu but didn’t work

Thank you!

Hi @benjamilbz ,

I’m currently not at home where I can check it. But isn’t there an option when starting the EC2 to run some of your provided scripts?

Check out here:
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html

Let me know if this was any helpful for you.

Best, Alex

cron could be one way, another could be to create a systemd process:

(I don’t have a Streamlit article off-hand, as this isn’t really a Streamlit thing)

Best,
Randy

Thanks! I tried user data and crontab but didn’t work. I’m trying to avoid having to ssh to start the app - i’ll look into system d
thank you!

Understood. I would check to ensure that your script is available from the account where you want it to run. Often, a well chosen chmod or chown statement can make everything work as desired.

Got it - i’m a newbie here - the only script i want to run is “streamlit run myapp.py” so that the app starts when i start the ec2 instance. What i tried is adding “@reboot streamlit run myapp.py” to the crontab. Would you suggest a different way ?
thank you!