Use a custom domain

  1. Register your domain with Route 53.
  2. Point the domain to the loadbalancer DNS.

Custom domain for your Streamlit App

Create a record in the Route53 console to point app.[YOUR_DOMAIN] to the Streamlit App.

You can visit the app at http://app.aidev.run

Note the http in the domain name.

Custom domain for your FastApi App

Create a record in the Route53 console to point api.[YOUR_DOMAIN] to the FastApi App.

You can access the api at http://api.aidev.run

Note the http in the domain name.

Add HTTPS

To add HTTPS:

  1. Create a certificate using AWS ACM. Request a certificat for *.[YOUR_DOMAIN]
  1. Creating records in Route 53.
  1. Add the certificate ARN to Apps
Make sure the certificate is Issued before adding it to your Apps

Update the llm-app/workspace/prd_resources.py file and add the load_balancer_certificate_arn to the FastApi and Streamlit Apps.

workspace/prd_resources.py

# -*- Streamlit running on ECS
prd_streamlit = Streamlit(
    ...
    # To enable HTTPS, create an ACM certificate and add the ARN below:
    load_balancer_enable_https=True,
    load_balancer_certificate_arn="arn:aws:acm:us-east-1:497891874516:certificate/6598c24a-d4fc-4f17-8ee0-0d3906eb705f",
    ...
)

# -*- FastApi running on ECS
prd_fastapi = FastApi(
    ...
    # To enable HTTPS, create an ACM certificate and add the ARN below:
    load_balancer_enable_https=True,
    load_balancer_certificate_arn="arn:aws:acm:us-east-1:497891874516:certificate/6598c24a-d4fc-4f17-8ee0-0d3906eb705f",
    ...
)
  1. Create new Loadbalancer Listeners

Create new listeners for the loadbalancer to pickup the HTTPs configuration.

The certificate should be Issued before applying it.

After this, https should be working on your custom domain.

  1. Update existing listeners to redirect HTTP to HTTPS

After this, all HTTP requests should redirect to HTTPS automatically.