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
- Django, Python 3.13
- gunicorn
Runs on
- CloudFront
- origin access control for S3
- response headers policy
- S3
- API Gateway, regional
- custom domain
- API key
- Lambda, Python 3.13, with the Lambda Web Adapter layer
Foundation
- inf-baseline
- Wiz scanning
- Scheduled deploys and checks
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/