Deployment of Streamlit app on AWS EC2 instance
Amazon Web Services(AWS)
AWS (Amazon Web Services) is a comprehensive, evolving cloud computing platform provided by Amazon that includes a mixture of infrastructure as a service (IaaS), platform as a service (PaaS) and packaged software as a service (SaaS) offerings. AWS services can offer an organization tools such as compute power, database storage and content delivery services.
AWS launched in 2006 from the internal infrastructure that Amazon.com built to handle its online retail operations. AWS was one of the first companies to introduce a pay-as-you-go cloud computing model that scales to provide users with compute, storage or throughput as needed.
AWS offers many different tools and solutions for enterprises and software developers that can be used in data centers in up to 190 countries. Groups such as government agencies, education institutions, nonprofits and private organizations can use AWS services.
Commonly Used Services Provided by AWS
The catalog of services available from Amazon Web Services is extensive -- storage, migration, security, customer engagement, developer tools and dozens more. These are among the most commonly used services from AWS:
For information about Streamlit refer my below Article:
Python Code to Create a Image Search Engine:
import streamlit as st
from PIL import Image
import requests
st.markdown("<h1 style='text-align: center; color: lightblue;'>The Maple Project</h1>", unsafe_allow_html=True)
st.text('')
st.markdown("<h2 style='text-align: center; color: lightblue;'>Welcome to Our Search Engine :-)</h2>", unsafe_allow_html=True)
st.text('')
image = Image.open('image3.jpg')
st.image(image)
download = st.text_input('Enter Anything to Search')
val=st.button("Submit")
if val:
site = 'https://www.google.com/search?tbm=isch&q='+download
getURL = requests.get(site, headers={"User-Agent":"Mozilla/5.0"})
print(getURL.status_code)
from bs4 import BeautifulSoup
soup = BeautifulSoup(getURL.text, 'html.parser')
images = soup.find_all('img')
imageSources = []
for image in images:
imageSources.append(image.get('src'))
imgList=[]
for _ in imageSources:
if 'https' in _:
imgList.append(_)
im=[]
col1, col2, col3 = st.columns(3)
col4, col5, col6 = st.columns(3)
with col1:
im=Image.open(requests.get(imgList[0], stream=True).raw)
st.image(im, width=200)
with col2:
im=Image.open(requests.get(imgList[1], stream=True).raw)
st.image(im, width=200)
with col3:
im=Image.open(requests.get(imgList[2], stream=True).raw)
st.image(im, width=200)
with col4:
im=Image.open(requests.get(imgList[3], stream=True).raw)
st.image(im, width=200)
with col5:
im=Image.open(requests.get(imgList[4], stream=True).raw)
st.image(im, width=200)
with col6:
im=Image.open(requests.get(imgList[5], stream=True).raw)
st.image(im, width=200)
Steps to Launch an EC2 instance:
1. Login to your AWS Management Console
2. Search for EC2 services.
3. Launch an EC2 instance by selecting AMI, instance type, security group, VPC, and key-pair.
Recommended by LinkedIn
4. Connect to launched EC2 instance.
5. Upload your code to a S3 bucket.
6. Get your code from S3 bucket to EC2 instance.
7. Install all the dependencies for the code in the EC2 instance.
8. Execute the Python Streamlit code.
9. Access the WebPage using the above External IP.
Thank you for Reading my article....
Keep it up 👍