tf-python-cloudfront-url.patterns.advancelocal.dev

tf-python-cloudfront-url

A plain Python handler on a Lambda function URL from OpenTofu. CloudFront serves the page from S3, caches /api/live for 5 seconds, and lets /api/private through only with a caller key.

App

Runs on

Foundation

Cache, live

Polling /api/live every second through CloudFront.

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

    Caller key

    /api/private needs an x-api-key header, which CloudFront checks before the request reaches the app. Without a valid key CloudFront answers 403.

    curl -H 'x-api-key: <your key>' https://tf-python-cloudfront-url.patterns.advancelocal.dev/api/private

    Deployed with OpenTofu, one root module. How it works

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