Streamlit
Overview
Streamlit is a Python framework for building and sharing data apps. You write a Python script, and Streamlit turns it into an interactive web app with charts, dataframes, widgets and maps, with no front-end code. Data scientists and ML engineers use it for dashboards, internal tools and model demos.
This SecureAnyCloud image installs Streamlit 1.58.0 in a dedicated Python virtualenv and serves a sample dashboard app as a systemd service. The service is bound to loopback behind an nginx reverse proxy on port 80 with HTTP Basic authentication. Every VM generates a unique login password on first boot.
What you get:
- Streamlit 1.58.0 in a Python virtualenv at
/opt/streamlit/venv, with pandas and numpy - A sample interactive dashboard app at
/var/lib/streamlit/app.py - nginx on
:80, fronting the loopback Streamlit server with HTTP Basic authentication and websocket proxying - A dedicated Azure data disk at
/var/lib/streamlitthat holds the app and its data. It is separate from the OS disk and re-provisioned with every VM. streamlit.serviceandnginx.serviceas enabled, active systemd units- 24/7 SecureAnyCloud support
Prerequisites
You need an active Azure subscription, an SSH key pair, and a VNet with a subnet in the target region.
Standard_B2ms (2 vCPU / 8 GiB RAM) is a good starting size. Scale up for heavier apps.
In the network security group (NSG), allow inbound 22/tcp from your management network and 80/tcp for the app. For public exposure, put TLS in front of the app (see Enabling HTTPS).
Step 1 - Deploy from the Azure Marketplace
Sign in to the Azure Portal, choose Create a resource, search the Marketplace for Streamlit by SecureAnyCloud, and select Create.
On the Basics tab, pick your subscription, resource group, region and size. Under Administrator account, choose SSH public key and paste your key. Under Inbound port rules, allow SSH (22) and HTTP (80).
Review the dedicated data disk on the Disks tab, then select Review + create and Create.
Step 2 - Deploy from the Azure CLI
# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn sac1647283583153:streamlit-ubuntu-24-04:default:latest
az vm create \
--resource-group <your-rg> \
--name streamlit \
--image sac1647283583153:streamlit-ubuntu-24-04:default:latest \
--size Standard_B2ms \
--admin-username azureuser \
--ssh-key-values ~/.ssh/id_ed25519.pub \
--vnet-name <your-vnet> --subnet <your-subnet> \
--public-ip-sku Standard
az vm open-port --resource-group <your-rg> --name streamlit --port 80 --priority 1010Step 3 - Connect to your VM
ssh azureuser@<vm-public-ip>Step 4 - Confirm the services are running
systemctl is-active streamlit.service nginx.serviceBoth services report active. Streamlit takes a few seconds to start.
Step 5 - Retrieve your password
Your VM generates a unique admin password on first boot and writes it to a root-only file. Read it with:
sudo cat /root/streamlit-credentials.txtThe file contains STREAMLIT_ADMIN_USER (admin), STREAMLIT_ADMIN_PASSWORD and the app URL. Store the password in a safe place.
Step 6 - Check the health endpoint
nginx serves an unauthenticated health endpoint for load balancers and probes. Query it with:
curl -s http://localhost/healthIt returns ok.
Step 7 - Open the app
Browse to http://<vm-public-ip>/ and sign in as admin with the password from Step 5.
The bundled sample app demonstrates Streamlit's building blocks: a sidebar with interactive widgets, metrics, a live line chart and a dataframe. Move the sliders and the app reruns instantly.
Scroll down to see the chart and the data table:
Step 8 - Confirm the server from the command line
Streamlit also exposes a health endpoint behind the same Basic authentication. Confirm that it is serving:
curl -s -u admin:<STREAMLIT_ADMIN_PASSWORD> http://localhost/_stcore/health; echoIt returns ok.
Step 9 - Deploy your own app
Replace the sample script with your own Streamlit app, then restart the service:
# edit /var/lib/streamlit/app.py with your Streamlit code, then:
sudo systemctl restart streamlitInstall any extra Python packages your app needs into the bundled virtualenv:
sudo /opt/streamlit/venv/bin/pip install <your-packages>
sudo systemctl restart streamlitThe app reloads, and your dashboard is served at the same URL behind the same authentication.
Step 10 - Confirm the app lives on the dedicated disk
Your app and its data are stored on the dedicated Azure data disk, so they survive OS changes and can be resized independently. Confirm the mount:
findmnt /var/lib/streamlitA separate Azure data disk backs the mount. The disk is captured into the image and re-provisioned on every VM.
Enabling HTTPS
The nginx reverse proxy serves plain HTTP on port 80. To expose the app publicly, add TLS in front of it.
Add a DNS name for the VM. Then either use the companion SecureAnyCloud nginx-ssl-certbot image as a TLS reverse proxy, or install certbot and extend the existing nginx site with a listen 443 ssl; server block.
Keep Streamlit bound to loopback, so the only public surface is the authenticated, TLS-terminated proxy. The proxy already forwards the websocket that Streamlit needs.
Maintenance
- Your app: edit
/var/lib/streamlit/app.py, or point the service at a different file, then runsudo systemctl restart streamlit. - Packages: install them into
/opt/streamlit/venvwith itspip. - Backups: snapshot the
/var/lib/streamlitdata disk. - Upgrades: run
sudo /opt/streamlit/venv/bin/pip install -U streamlit, thensudo systemctl restart streamlit. - Security patches: unattended-upgrades stays enabled, so the OS keeps receiving security updates automatically.
Support
SecureAnyCloud provides 24/7 support for this image. Contact sales@secureanycloud.com.
Deploy on Azure
Launch Streamlit on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.
View this image
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com
Overview
Streamlit is an open-source Python framework for building and sharing interactive data and machine learning apps. You write plain Python scripts, and Streamlit turns them into web apps with widgets, charts, dataframes and layout, with no front-end code.
This SecureAnyCloud image runs Streamlit 1.58.0 on AWS behind an authenticating nginx proxy. It includes a working multi-widget demo app that you replace with your own.
What you get:
- Streamlit 1.58.0 in a dedicated Python virtual environment under
/opt/streamlit, run by an unprivilegedstreamlitsystem account under a systemd service that starts on boot and restarts on failure - A dedicated, independently resizable EBS data volume at
/opt/streamlitthat holds the virtual environment and theapp.pyyou replace with your own app. It survives an operating system disk reimage. - A multi-widget demo app at
/opt/streamlit/app.py, so the app works out of the box and gives you an example to learn from - A Streamlit runtime bound to the loopback interface only (
127.0.0.1:8501), never exposed directly, because Streamlit has no built-in authentication - An nginx reverse proxy that publishes the app on port 80 behind HTTP Basic authentication and forwards the WebSocket upgrade that Streamlit needs
- An admin password generated on the first boot of every instance, so two instances launched from the same Amazon Machine Image never share a password. It is written to
/root/streamlit-credentials.txtwith mode 0600, readable only by root.
Prerequisites
You need:
- An Amazon Web Services account where you can launch EC2 instances
- IAM permissions to launch instances, create security groups and subscribe to AWS Marketplace products
- An EC2 key pair in the target Region for SSH access to the instance
- A VPC and subnet in the target Region, with a security group that allows inbound port 22 from your management network and port 80 for the Streamlit app
- The AWS CLI (version 2) installed locally, if you plan to deploy from the command line
Launch the Instance from the AWS Marketplace
Sign in to the AWS Management Console, open the EC2 service, and select Launch instance. Under Application and OS Images, choose AWS Marketplace AMIs and search for Streamlit. Select the SecureAnyCloud listing, choose Select, then choose Continue on the subscription summary.
Pick an instance type of t3.large or larger. Choose your EC2 key pair under Key pair (login). Under Network settings, select your VPC and subnet, then create or select a security group that opens port 22 from your management network and port 80 for the Streamlit app. Leave the root volume at the default size or larger.
Select Launch instance. After the instance state becomes Running and the status checks pass, first-boot initialisation takes a few seconds. This is when the per-instance admin password is generated.
Launch the Instance from the AWS CLI
This command launches an instance from the SecureAnyCloud Streamlit Marketplace AMI into an existing subnet and security group. Replace <ami-id> with the AMI ID shown on the Marketplace listing, <key-name> with your EC2 key pair name, <subnet-id> with your subnet ID, and <security-group-id> with a security group that opens ports 22 and 80 as described above.
aws ec2 run-instances \
--image-id <ami-id> \
--instance-type t3.large \
--key-name <key-name> \
--subnet-id <subnet-id> \
--security-group-ids <security-group-id> \
--tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=streamlit}]'When the instance reaches the Running state and passes its status checks, note its public IP address or DNS name. Find them in the EC2 console or with aws ec2 describe-instances.
Connect to Your Instance
Connect over SSH with your key pair and the login user for your operating system variant.
OS variant SSH login user
Ubuntu 24.04 ubuntu
ssh -i <key-name>.pem ubuntu@<public-ip>Retrieve the Admin Password
The admin password is unique to your instance and was generated on first boot. Read the credentials file as root:
sudo cat /root/streamlit-credentials.txtThe file lists the app URL, the admin user (admin) and the generated password. It also includes hints for replacing the demo app and installing extra Python packages. Keep the password in a safe place.
Sign In to the Streamlit App
The Streamlit app is served on port 80 by nginx, which proxies to the runtime on 127.0.0.1:8501 with the WebSocket upgrade Streamlit needs. In a browser, go to:
http://<instance-public-ip>/The nginx proxy prompts for credentials. Sign in as admin with the password from the credentials file. The bundled demo app loads, with the sidebar controls on the left, the chart and summary in the centre and an interactive dataframe further down the page.
The demo app is a multi-widget showcase. The sidebar holds a row count slider, a series count slider, a random seed input and a chart type selector. Each time you change a control, Streamlit reruns the script and re-renders the page. Switch the chart type from Line to Bar to see the chart update instantly.
Scroll down to the Interactive data section. It shows the underlying pandas DataFrame as a sortable, scrollable table that updates with the sidebar controls.
Confirm Streamlit Is Running
Over SSH, confirm that the runtime and the nginx proxy are active and that the health endpoint answers:
sudo systemctl is-active streamlit nginxcurl -s http://127.0.0.1:8501/_stcore/healthBoth services report active, and the Streamlit health endpoint returns ok. The runtime listens on 127.0.0.1:8501 (loopback only), and nginx publishes it on port 80 behind the login. The /_stcore/health endpoint is unauthenticated, so external health checks work.
Confirm the installed Streamlit version:
/opt/streamlit/venv/bin/streamlit versionReplace the Demo App with Your Own
The demo app lives at /opt/streamlit/app.py. To serve your own app, replace that file with your Streamlit script and restart the service. Copy your file onto the instance, for example with scp, then move it into place and restart:
sudo systemctl restart streamlit.serviceAfter the restart, reload the app in your browser. The service runs streamlit run /opt/streamlit/app.py bound to loopback, so your app.py is served on port 80 through the same authenticating proxy. Keep the file owned by the streamlit user so that the service can read it.
Install Extra Python Packages
Streamlit and its dependencies live in a dedicated virtual environment at /opt/streamlit/venv. To use additional Python libraries in your app, install them into that same virtual environment so that the service picks them up:
sudo /opt/streamlit/venv/bin/pip install --upgrade pipThen install what your app needs, for example sudo /opt/streamlit/venv/bin/pip install plotly altair scikit-learn, and restart the service with sudo systemctl restart streamlit.service. The virtual environment lives on the dedicated data volume, so your installed packages persist independently of the operating system disk.
The Data Volume
The application directory lives on a dedicated EBS volume mounted at /opt/streamlit. This keeps the virtual environment and your app.py off the operating system disk, and you can resize or snapshot them independently. Confirm the mount:
df -h /opt/streamlitTo grow the application directory, expand the EBS volume in the AWS console, then grow the filesystem on the instance with sudo resize2fs on the underlying device. The volume holds both the virtual environment and your app, so a snapshot captures the complete state of your Streamlit deployment.
Enable HTTPS
nginx serves the Streamlit app over plain HTTP on port 80. To use it in production, place it behind TLS.
Obtain a certificate for your domain. For example, use a managed certificate on an Application Load Balancer in front of the instance, or install Certbot on the instance. Then configure nginx to listen on 443 with your certificate and proxy to 127.0.0.1:8501, exactly as the bundled site does for port 80. Keep the WebSocket upgrade headers and the HTTP Basic authentication in place so that the app continues to render.
Restrict the security group so that ports 80 and 443 are reachable only from the networks that need the app.
Backup and Maintenance
To back up your deployment, snapshot the /opt/streamlit EBS volume. The snapshot captures the virtual environment, your installed packages and your app.py. You can also keep your app under version control and redeploy it to a fresh instance.
Apply operating system security updates with sudo apt-get update && sudo apt-get upgrade, and reboot when a new kernel is installed. Streamlit and nginx start automatically on boot.
Support
SecureAnyCloud publishes and supports this image. Support covers deployment, deploying your own app, Python dependency management, the virtual environment, the authenticating proxy, TLS, authentication and performance tuning. Contact SecureAnyCloud through the support channel listed on the AWS Marketplace listing.
All product and company names are trademarks or registered trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.
Deploy on AWS
Launch Streamlit on AWS with 24/7 support from SecureAnyCloud.
View on Marketplace
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com