Source: examples/streamlit

Streamlit + SkyPilot#

Deploy your Streamlit app with SkyPilot.

Streamlit Demo

Quick start#

Launch the app using streamlit.sky.yaml:

sky launch -c streamlit-app streamlit.sky.yaml # specify "--infra aws" or other cloud if desired

Tip: Add -d to detach and return to your terminal immediately: sky launch -c streamlit-app streamlit.sky.yaml -d

Get the endpoint URL:

ENDPOINT=$(sky status --endpoint 8501 streamlit-app)
echo "Streamlit app: $ENDPOINT"

Open the URL in your browser to access your app.

Using your own Streamlit app#

  1. Replace app.py with your own Streamlit application

  2. Update streamlit.sky.yaml:

    • Add any dependencies to the setup section

    • Modify the run command if your app has a different filename

  3. Launch:

    sky launch -c my-app streamlit.sky.yaml
    

Example with requirements.txt#

If your app needs additional packages, update the YAML:

setup: |
  pip install streamlit
  pip install -r requirements.txt

Teardown#

Stop the cluster when done:

sky down streamlit-app

Advanced options#

Custom port#

resources:
  ports: 8080

run: |
  streamlit run app.py --server.port 8080 --server.address 0.0.0.0

Specific cloud/instance#

resources:
  infra: aws # or "infra: aws/us-east-1" or "infra: gcp" or "infra: azure" etc.
  instance_type: t3.medium
  ports: 8501

Files#

Learn more#

Included files#