Own project

devopsdev.de – this website

Static website on AWS with a strict CSP, deployment without stored keys, PR previews and automatic profile delivery.

Fact sheet

Role
Design, implementation, operation
Period
since 11/2026
Status
live
Technology
  • Hugo
  • AWS S3
  • CloudFront
  • Lambda
  • Terraform
  • GitHub Actions
  • Microsoft Graph

Starting point

I wanted a website that doesn’t just talk about cloud security but is built the way I would recommend to clients: no servers, no data sent to third parties, infrastructure you can trace, and a deployment that works without stored access keys. There was also a practical requirement: my profile should go out on request right away, without putting the PDFs on the public web.

Solution

Architecture: CloudFront in front of a private S3 bucket, GitHub Actions with OIDC and Terraform, Lambda for profile delivery
  • Serving: The site lives in a private S3 bucket that only CloudFront may read. CloudFront enforces HTTPS, HSTS and a strict Content Security Policy and redirects www to the main domain.
  • Build and deploy: Every change goes through GitHub Actions. The pipeline signs in to AWS via OIDC, so there are no access keys in GitHub. Two separate roles ensure a pull request can only touch previews at staging-<n>.devopsdev.de, never the live site.
  • Profile on request: A Lambda function reads a folder of my mailbox via Microsoft Graph every five minutes and replies with links that are valid for 24 hours. The PDFs live in a separate private bucket and can only be fetched with a valid signature.
  • Content: The site is built with Hugo – bilingual, with self-hosted fonts, light/dark mode and images Hugo generates itself (favicon, preview image, photo variants).

Details

Strict Content Security Policy

The policy only allows resources from the site’s own domain – no inline scripts, no inline styles, no third-party fonts. It is defined as code in Terraform:

content_security_policy {
  content_security_policy = "default-src 'none'; img-src 'self'; style-src 'self'; font-src 'self'; script-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'"
  override                = true
}

To keep it that way, a test checks every built page and fails the build as soon as anything would violate the policy:

test_csp_clean() {
  for f in $(html_files); do
    assert_not_matches "$f" 'style="'
    assert_not_matches "$f" '<script(?![^>]*\bsrc=)[^>]*>'
    assert_not_matches "$f" '\son[a-z]+="'
    assert_not_matches "$f" '\ssrc="https?://'
  done
}

Deployment without stored keys

The pipeline signs in via OIDC with an AWS role that is valid for the master branch only, and uploads the site only after build and tests with a pinned Hugo version have passed:

permissions:
  id-token: write
  contents: read

steps:
  - name: Install Hugo
    run: scripts/install-hugo.sh        # pinned version, checksum verified
  - name: Test site
    run: tests/site-test.sh
  - name: Build site
    run: ./.bin/hugo --minify --cleanDestinationDir
  - uses: aws-actions/configure-aws-credentials@v4
    with:
      role-to-assume: ${{ vars.AWS_ROLE_ARN }}

The links in the reply are CloudFront signed URLs with an expiry time – without a signature CloudFront won’t serve the PDFs:

function signUrl(url, expires, privateKey) {
  const policy = JSON.stringify({
    Statement: [{ Resource: url, Condition: { DateLessThan: { "AWS:EpochTime": expires } } }],
  });
  const signature = createSign("RSA-SHA1").update(policy).sign(privateKey, "base64")
    .replace(/\+/g, "-").replace(/=/g, "_").replace(/\//g, "~");
  return `${url}?Expires=${expires}&Signature=${signature}&Key-Pair-Id=${env.KEY_PAIR_ID}`;
}

Screenshots

Home page in light mode
Home page, light mode
Home page in dark mode
The same content in dark mode – the site follows the system setting, the toggle remembers the choice
Home page on a phone
On a phone: photo in landscape format, reduced navigation

Outcome

  • The site runs without servers, cookies or tracking and loads nothing from third parties.
  • Every change to the site goes through a build and more than 30 automated tests before it is uploaded; pull requests also get a Terraform plan and their own preview.
  • Profile requests are answered automatically within minutes.
  • Running costs are about 0.50 to 1 US dollar per month.

← Back to work