There are no items in your cart
Add More
Add More
Item Details | Price |
---|
Thu Sep 28, 2023
Streamlit has emerged as a popular framework for data scientists and developers looking to turn data scripts into interactive web applications. AWS EC2, on the other hand, offers scalable computing capacity in the cloud. Combining the two, we can deploy Streamlit apps on AWS, making them accessible to a wide audience.
In this guide, we'll walk you through the process step by step
Step 1. Setting Up an EC2 Instance
Before deploying your Streamlit app, you need an AWS EC2 instance. Create one from the AWS Management Console, choosing an appropriate instance type (e.g., t2.micro
for testing). Ensure your instance has a security group allowing inbound traffic on port 8501 (Streamlit's default port) and port 22 for SSH.
Step 2. Connecting to the EC2 Instance
Use the following command to establish an SSH connection using any terminal software that supports SSH commands like Git bash:
ssh -i "path_to_your_key.pem" ubuntu@YOUR-EC2-IP-ADDRESS
"path_to_your_key.pem"
with the path to your private key and YOUR-EC2-IP-ADDRESS
with your instance's IP address sudo apt update && sudo apt upgrade -y
sudo apt install python3 python3-pip -y
pip3 install streamlit
.pem
file used for SSH.requirements.txt
file. Once uploaded, install them on the EC2 instance:pip3 install -r requirements.txt
export PATH=$PATH:/home/ubuntu/.local/bin
streamlit run home.py
nohup streamlit run Home.py > streamlit.log 2>&1 &
streamlit.log
.requirements.txt
and installed on the EC2 instance.protobuf
can arise. Consider downgrading the protobuf
package if faced with such errors.Deploying a Streamlit app on AWS EC2 is a straightforward process, allowing you to share your interactive data applications with a broader audience. While the steps provided get you started, remember that for a full-fledged production environment, consider more robust deployment methods, including containerization and orchestration tools.
CampusX