Secure Edge Delivery static.ju25.uk
P1 Amazon CloudFront · private S3 · Terraform · GitHub OIDC

The bucket never faces the internet.

You are reading a file from a private Amazon S3 bucket. Its only reader is one CloudFront distribution, which proves who it is with a SigV4 signature on every origin request. Terraform built the platform; GitHub Actions published this page without a single stored AWS key.

Request-path demonstrationRecorded
Pick a request to see how the platform answers
  1. GET https://static.ju25.uk/
  2. TLS 1.2+ handshake, ACM certificate
  3. Cache hit, or OAC-signed request to S3
  4. Bucket policy matches this distribution

200page served with CSP, HSTS, nosniff, DENY framing

  1. GET http://static.ju25.uk/
  2. viewer_protocol_policy = redirect-to-https
  3. S3 is never contacted

301Location: https://static.ju25.uk/

  1. GET https://<bucket>.s3.ap-south-2.amazonaws.com/index.html
  2. CloudFront bypassed: no signature
  3. Block Public Access and the bucket policy refuse

403AccessDenied. The bucket has no public path.

  1. GET https://static.ju25.uk/does-not-exist
  2. S3 answers 403: CloudFront may not list the bucket
  3. custom_error_response maps 403 and 404 to /404.html

404custom not-found page, cached 60 seconds

Each outcome was observed on 4 Dec 2026 at 17:25 UTC by scripts/verify_deployment.py: https-200, http-redirects, security-headers, direct-s3-denied and unknown-path-404 all passed.

01 Purpose

Hosting files is easy. Hosting them safely takes design.

The usual shortcuts are a public bucket, an access key stored in CI, or a console click that nobody can reproduce. This platform removes all three and keeps every decision in code that can be read, tested, rebuilt and destroyed.

Public buckets
0
Stored AWS keys
0
Pipeline roles
3
Terraform resources
12 + 1
Monthly cost
Cents

12 resources in the first apply, plus the routing function added later. The cost is an estimate at demonstration traffic, not a measured bill.

02 Interactive request lifecycle

Ten steps between a name and a byte

Each step says what it does, how it is configured in the deployed Terraform, which security boundary it enforces and what happens when it fails. Use the list, the arrow keys or the buttons.

  1. DNS
  2. Edge
  3. TLS
  4. OAC
  5. SigV4
  6. S3
  7. Policy
  8. Deploy
  9. OIDC
  10. Invalidate
  1. 01DNS resolution
  2. 02CloudFront edge delivery
  3. 03HTTPS and TLS
  4. 04Origin Access Control
  5. 05SigV4 authentication
  6. 06Private S3 origin
  7. 07Bucket policy enforcement
  8. 08GitHub Actions deployment
  9. 09OIDC role assumption
  10. 10Cache invalidation
Step 01 · Cloudflare DNS

DNS resolution

The browser looks up static.ju25.uk and gets a CNAME to the distribution's *.cloudfront.net name. Anycast routes it to a nearby edge.

Configuration

A DNS-only (grey cloud) record at Cloudflare, so TLS ends at CloudFront with this platform's own certificate. The ACM validation CNAME stays in place for automatic renewal.

Security boundary

None of its own. DNS is outside AWS and managed by hand; integrity comes from TLS in step 03.

If it fails

A wrong or missing record means the name does not resolve, and nothing in AWS can help. If the validation record is deleted, ACM cannot renew and the certificate expires in June 2027. Runbook: certificate and DNS.

Step 02 · cloudfront.tf

CloudFront edge delivery

The edge serves from cache when it can and fetches from the origin on a miss. A viewer-request function sends the projects.ju25.uk host to the portfolio page.

Configuration

  • PriceClass_200, which includes India
  • Managed CachingOptimized policy, compression on
  • Only GET and HEAD; HTTP/2 and HTTP/3; IPv6
  • 403 and 404 become /404.html

Security boundary

The only public entry point. Every rule (TLS, headers, methods) is applied here, in one place.

If it fails

Edge outages are AWS's to fix. Misconfiguration is ours, and every change is planned on a pull request, approved and checked again for drift afterwards.

Step 03 · domain.tf, cloudfront.tf

HTTPS and TLS

CloudFront presents an ACM certificate for the custom names and redirects plain HTTP with a 301. HSTS tells browsers to use HTTPS for a year.

Configuration

  • ACM certificate in us-east-1, DNS-validated, sni-only
  • minimum_protocol_version = TLSv1.2_2021
  • viewer_protocol_policy = redirect-to-https
  • HSTS max-age=31536000; includeSubDomains

Security boundary

Encryption and server identity in transit. A TLS 1.1 handshake was refused (checked 4 Dec 2026).

If it fails

An expired or mismatched certificate makes browsers refuse the site. ACM renews on its own while the validation record exists. The certificate is valid until 20 June 2027.

Step 04 · aws_cloudfront_origin_access_control

Origin Access Control

On a cache miss CloudFront does not fetch the object anonymously. OAC makes it sign the origin request as the CloudFront service, on behalf of this one distribution.

Configuration

origin_access_control_origin_type = "s3"
signing_behavior                  = "always"
signing_protocol                  = "sigv4"

Security boundary

Proves CloudFront's identity to S3. It replaces the legacy Origin Access Identity, which cannot sign every request type and is no longer recommended.

If it fails

If OAC is detached, S3 gets unsigned requests and answers 403, which visitors see as the 404 page. It fails closed: no content leaks.

Step 05 · Signature Version 4

SigV4 authentication

The origin request carries a SigV4 signature from the CloudFront service principal and the distribution's ARN as its source. S3 checks the signature before it reads the policy.

Configuration

Nothing to store or rotate. CloudFront holds the signing credentials, and the trust is expressed only in the bucket policy (step 07).

Security boundary

Authenticity and integrity of the origin request, so a third party cannot pose as this distribution.

If it fails

A bad signature is a 403 at S3, again failing closed. The configuration check oac-signs-sigv4 runs after every infrastructure change.

Step 06 · s3.tf

Private S3 origin

The bucket holds the files and nothing else can read them. Its name comes from a generated suffix, so it does not reveal the account ID.

Configuration

  • Block Public Access: all four settings on
  • Object ownership BucketOwnerEnforced, so ACLs are off
  • Versioning, with old versions expiring after 30 days
  • SSE-S3 encryption at rest

Security boundary

Confidentiality of the origin. Even a mistaken public policy is blocked by Block Public Access.

If it fails

A deleted or overwritten object can be recovered from its previous version for 30 days. Publishing a wrong commit is reversed by republishing an older one (rollback).

Step 07 · aws_s3_bucket_policy

Bucket policy enforcement

Two statements: read access for exactly one distribution, and a deny for any request that does not use TLS.

Allow  s3:GetObject  Principal: cloudfront.amazonaws.com
       Condition: AWS:SourceArn = <this distribution>
Deny   s3:*          Principal: *
       Condition: aws:SecureTransport = false

Configuration

Written in Terraform with the distribution's ARN, so another distribution, even in another account using the same service principal, is refused.

Security boundary

Authorisation: who may read which objects. Listing is never allowed, which is why a missing key returns 403.

If it fails

The configuration check only-this-distribution fails the run if the policy drifts. Runbook: CloudFront and S3 access.

Step 08 · deploy-site.yml, deploy_site.sh

GitHub Actions deployment

A merge that touches site/ runs validation, then waits for approval of the production environment, then publishes.

Configuration

  1. Refuse symbolic links; require index.html and 404.html
  2. Upload assets first, then HTML and version.json
  3. Delete files that are gone only at the end
  4. A rollback input accepts only commits already on main

Security boundary

Change control: a named approval plus a commit that passed every check.

If it fails

A failed upload leaves the old pages in place, because pages are uploaded after their assets. The verify job fails the run if the live commit differs from the one expected.

Step 09 · infra/bootstrap/bootstrap.yaml

OIDC role assumption

The job asks GitHub for a signed OIDC token and exchanges it with AWS STS for credentials that last about an hour. Nothing long-lived exists to leak.

aud = sts.amazonaws.com
sub = repo:ShivaSai06@<owner-id>/secure-static-platform@<repo-id>:environment:production

Configuration

Three roles: plan (read-only, pull requests and main), apply (environment infra) and deploy (environment production: upload and invalidate only). Trust uses the numeric IDs, so a renamed or re-created repository cannot inherit it.

Security boundary

Identity of the pipeline. The pipeline can never create or change IAM roles; those come from the bootstrap stack.

If it fails

"Not authorized to perform sts:AssumeRoleWithWebIdentity" means the token's sub did not match. Runbook: diagnose OIDC failures.

Step 10 · deploy_site.sh

Cache invalidation

After uploading, the script invalidates /* and waits until every edge has dropped the old copies. Then the verify job asks for /version.json.

Configuration

  • HTML and version.json: Cache-Control: no-cache
  • Other assets: public, max-age=300
  • Invalidation path /*, which is free at this volume

Security boundary

Consistency: visitors never get new HTML that points to assets missing from the edge.

If it fails

The run fails while waiting, and old content is served until the TTL expires. Running the workflow again is safe, because the upload and the invalidation are idempotent.

A visitor connects over HTTPS to Amazon CloudFront. CloudFront uses Origin Access Control to read from a private S3 bucket. A direct request from the visitor to S3 is denied. GitHub Actions exchanges an OIDC token for IAM roles that manage CloudFront and upload files to S3.
The whole platform on one page. Also available as Mermaid source.
03 Security

Every control, and what it prevents

ControlWhat it prevents
Block Public Access, all fourA policy or ACL accidentally publishing the bucket
Bucket owner enforcedObject ACLs granting access outside the policy
OAC with SigV4CloudFront reading the origin without proving who it is
Policy tied to one distributionAnother distribution, in any account, reading these files
TLS required by the bucketUnencrypted requests to S3
HTTPS redirect, TLS 1.2+, HSTSDowngrade to plaintext or weak protocols
Deny-by-default CSPInjected or third-party scripts and styles
Three OIDC rolesLeaked long-lived keys; one stage holding every permission
Protected Terraform stateState loss, tampering or two applies at once: a private, versioned, encrypted bucket with TLS-only access and S3 lock files
Pinned actions, read-only tokenA changed third-party action altering the pipeline
Response headers of this pageLive
strict-transport-security: max-age=31536000; includeSubDomains
content-security-policy: default-src 'none'; script-src 'self'; style-src 'self'; connect-src 'self' https://app.ju25.uk; img-src 'self' https://github.com; base-uri 'none'; form-action 'none'; frame-ancestors 'none'; upgrade-insecure-requests
x-content-type-options: nosniff
x-frame-options: DENY
referrer-policy: strict-origin-when-cross-origin
permissions-policy: camera=(), microphone=(), geolocation=(), payment=()

Without JavaScript this shows the headers recorded on 4 Dec 2026 at 17:25 UTC. With it, your browser reads them again.

04 Infrastructure explorer

Two layers, so the pipeline never grants itself permissions

CloudFormation runs once to create the state bucket and the roles. Terraform then manages the platform as often as needed. Open any resource to see what it is for and where it is defined.

Platform · Terraform · infra/terraform/

aws_s3_bucket.siteS3

Origin bucket with a generated name suffix, force_destroy = false, so Terraform cannot delete a bucket that still holds content.

s3.tf
public_access_block · ownership · versioning · encryption · lifecycleS3

The guard rails around the bucket: no public access, no ACLs, 30 days of old versions, SSE-S3, and unfinished uploads removed after 7 days.

s3.tf
aws_s3_bucket_policy.siteIAM policy

Read for one distribution, deny without TLS. It depends on the public access block, so the order of creation is safe.

s3.tf
aws_cloudfront_origin_access_control.siteCloudFront

Always sign, with SigV4, for S3 origins.

cloudfront.tf
aws_cloudfront_response_headers_policy.siteCloudFront

Reads security_headers.json, the same file the verification script checks against, so the expected and deployed headers cannot drift apart.

security_headers.json
aws_cloudfront_function.showcaseCloudFront

A viewer-request function under 1 KB that serves the portfolio for the showcase host. Its routing is unit-tested in Node.

functions/showcase.js
aws_cloudfront_distribution.siteCloudFront

Ties it together: origin with OAC, HTTPS redirect, cache and headers policies, the function, error pages and the certificate.

cloudfront.tf
aws_acm_certificate · aws_acm_certificate_validationACM, us-east-1

Created only when custom domains are set. Validation waits for the DNS records, which are added by hand at Cloudflare.

domain.tf

Bootstrap · CloudFormation · infra/bootstrap/

StateBucketS3

Terraform state: private, versioned, encrypted, TLS only. State is locked with an S3 lock file (use_lockfile = true), so no DynamoDB table is needed.

bootstrap.yaml
PlanRoleIAM

Read-only. Trusted for pull requests and main. It produces the plan that reviewers read.

bootstrap.yaml
ApplyRoleIAM

Manages only resources with this project's name prefix. Trusted only for the infra environment, which needs an approval.

bootstrap.yaml
DeployRoleIAM

Upload to the site bucket and invalidate the distribution, nothing else. Trusted only for the production environment.

bootstrap.yaml
GitHub OIDC providershared, not owned

The account's existing provider is referenced, not created, so this project can be removed without breaking other repositories.

docs/bootstrap.md

Around the code

.github/workflows/6 workflows

validate, terraform-plan, terraform-apply, deploy-site, verify-deployment, terraform-destroy (which needs a typed confirmation).

workflows
tests/Python, Terraform

Unit tests for the scripts, workflows, IAM design, site and routing function, plus a mocked terraform test security suite.

tests
docs/design and operations

Architecture, ADRs, runbooks, security, evidence and interview notes.

docs
05 Deployment timeline

What actually ran

A snapshot of real GitHub Actions runs on 4 December 2026 (UTC), copied from the repository's evidence. It is not a live feed: the content policy lets this page talk only to itself and the container service.

  1. 05:57Validate on main #47277615699fd8e5f8 · success
  2. 06:03Plan with the read-only role #4727835787512 to add, 0 to change, 0 to destroy
  3. 06:05Terraform apply, infra approved #47278600842bd60884 · 12 added
  4. 06:16Publish, production approved #47280027636d1bb75c · all live checks passed
  5. 06:19Rollback to the previous commit #47280411395live version.json showed bd60884
  6. 06:21Roll forward #47280738962live version.json showed d1bb75c
  7. 06:24Drift check #47281053167No changes
  8. 07:37Apply for the routing function #472906900140124dfe · failed: the apply role could not tag the function
  9. 07:42Apply after a narrow permission fix #472914337871343df2 · 1 added, 1 changed
  10. 07:57Drift check #47293401149No changes

How a change reaches this page

  1. Pull request. Terraform format, validate, mocked tests and TFLint; Checkov, cfn-lint, gitleaks, actionlint, ShellCheck; Python tests; HTML validation; pa11y accessibility; link checks. A plan from the read-only role.
  2. Merge. Infrastructure changes wait for infra approval. Site changes wait for production approval.
  3. Publish. Upload in a safe order, invalidate and wait.
  4. Verify. Public smoke checks and AWS configuration checks. The run fails if any check fails.

Approvals are given by the repository owner, who is also the author. This is self-approval, not independent review, and it is listed as a limitation.

06 Verification

Checked from the outside and from the inside

verify_deployment.py · public viewRecorded 4 Dec 2026, 17:25 UTC
PASS  https-200           status 200
PASS  http-redirects      status 301, location https://static.ju25.uk/
PASS  security-headers    all present
PASS  direct-s3-denied    status 403
PASS  unknown-path-404    status 404
TLS 1.1 handshake         refused
certificate               Amazon RSA 2048, CN=static.ju25.uk, to 2027-06-20
verify_aws_config.py · AWS viewRecorded 4 Dec 2026
PASS  block-public-access
PASS  bucket-not-public
PASS  only-this-distribution
PASS  origin-uses-oac
PASS  oac-signs-sigv4
PASS  https-redirect
PASS  headers-policy-attached
PASS  modern-tls-on-custom-domain

Full outputs and run links: docs/evidence.

07 Cost decisions

Nothing runs while nobody visits

No compute
No servers, containers, databases, load balancers or NAT gateways.
Free certificate
ACM on an existing domain, with DNS at Cloudflare in DNS-only mode.
SSE-S3, not KMS
The content is public once served, so a paid key would add cost and policy without adding protection.
Bounded storage
Old versions expire after 30 days; unfinished uploads after 7.
Clean exit
Teardown is a workflow that needs a typed confirmation, documented in cleanup.
08 Known limitations

What this platform does not do