Request a certificate for the domain or subdomain of the URL of your desired app (myapp.domain.com) in AWS Certificate Manager
Run your app on EC2 (on an elastic IP)
Create an application load balancer with the SSL certificate that you created in the 2nd step, and target groups pointing to your EC2 IP.
Allow the EC2 access from the load balancer security group on 8501
Add additional listener rules to reroute HTTP to HTTPS
Note that there are other steps to check regarding security groups (who should be able to access the load balancer vs the server running Streamlit), proper records in the hosted zones for the domain, using the right ports in all the steps (443, 80, 8501) etc etc.
This is as simple as it can get in an AWS environment. The load balancer handles all traffic and the SSL protocols, and the EC2 instance runs faster this way running only Streamlit code.
Thanks all! I was running on AWS, but my domain was NOT in AWS (squarespace), so doing the load balancer route gets complicated - you have to do a Network Load Balancer in front of, and I couldn’t figure how to get all the balancers and targets to seeming work together. So I heavily borrowed from @Dhruv4 's great post - here was my entire thing, beginning to end, on a clean machine
Start a small instance on AWS using a stock ubuntu AMI
Set up a security group that allows HTTP, HTTPS, and SSH traffic
Register an Elastic IP address, and assign it to the instance
Go to domain registrar, and assign @ and www to the IP address
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.