tf-lwa-django-cloudfront-apigw.patterns.advancelocal.dev

tf-lwa-django-cloudfront-apigw

A Django app on Lambda through Lambda Web Adapter and gunicorn, from OpenTofu. CloudFront sends every request to a regional API Gateway custom domain, serves /static from S3, and caches /api/live for 5 seconds.

App

Runs on

Foundation

Cache, live

Polling /api/live every second through CloudFront.

--:--:--
    waiting for the first poll
    CloudFront hittrip to the app

    Django sees

    request.get_host()
    tf-lwa-django-cloudfront-apigw.patterns.advancelocal.dev
    request.build_absolute_uri()
    https://tf-lwa-django-cloudfront-apigw.patterns.advancelocal.dev/
    reverse("result")
    /result/

    Deployed with OpenTofu, one root module. How it works

    Would you like to play a game? Tetris courtesy of Jeff Hobbs.