GitHunt
AW

aws-samples/streamlit-applications-on-aws-cdk-example

Sample code from "Streamlit Applications on AWS CDK"

Streamlit Demo CDK

This CDK is an example of how you can deploy a Streamlit application in AWS. It uses ECS Fargate
for running the application.

Below is a diagram of the archicture used, at a high level:

alt text

Requirements

Docker

CDK will build the image that will be used by Amazon ECS. You will need Docker to be installed
on the machine building the CDK.

Route53 Zone

To associate the Amazon Cognito user pool to a domain, we create a custom domain in a Route 53
zone. You will need a Zone ID and a Domain Name to deploy this construct.

Python Environment

Make sure to setup the venv for the CDK, see the instructions in the CDK README.

python3 -m venv ./cdk/.venv
source ./cdk/.venv/bin/activate
pip install -r cdk/requirements.txt

Deploying

yarn install
yarn deploy \
    -c zone_id="<Route53 Zone Id>" \
    -c zone_name="<Route53 Domain Name (IE: samples.aws.com)>" \
    -c hostname="<Route53 Hostname for Application (IE: streamlit)>"

You can specify a custom AWS Cognito authentication domain prefix:

yarn install
yarn deploy \
    -c zone_id="<Route53 Zone Id>" \
    -c zone_name="<Route53 Domain Name (IE: samples.aws.com)>" \
    -c hostname="<Route53 Hostname for Application (IE: streamlit)>" \
    -c cognito_domain="<Cognito Domain Prefix (Default: streamlit-auth-[Account ID])>"

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

Languages

Python96.0%Dockerfile4.0%

Contributors

MIT No Attribution
Created January 24, 2025
Updated January 1, 2026