cloudfront-waf-hardening

cloudfront-waf-hardening is a skill for Claude Code, Codex from cncoder/serverless-litellm. It costs 73 tokens per session (3,286 once invoked), scanned A, original, MIT.

An AWS setup for putting an application load balancer behind CloudFront, AWS’s content delivery service, and WAF, its web request filter. It limits access to approved paths and prevents direct access to the load balancer.

In plain words
What is it for?
Use it when deploying an API or other service on AWS behind an application load balancer. It helps configure CloudFront, WAF rules, and the load balancer’s security group.
Why use it?
It reduces the risk of exposing an internet-facing service directly or allowing unwanted web requests to reach it.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/cncoder/serverless-litellm/cloudfront-waf-hardening
Any agent
npx skills add cncoder/serverless-litellm --skill cloudfront-waf-hardening
Clone the repo
git clone --depth 1 https://github.com/cncoder/serverless-litellm

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cloudfront-waf-hardening

README.md
[![agentmods](https://agentmods.dev/badge/skills/cncoder/serverless-litellm/cloudfront-waf-hardening.svg)](https://agentmods.dev/skills/cncoder/serverless-litellm/cloudfront-waf-hardening)
Your own site
<a href="https://agentmods.dev/skills/cncoder/serverless-litellm/cloudfront-waf-hardening"><img src="https://agentmods.dev/badge/skills/cncoder/serverless-litellm/cloudfront-waf-hardening.svg" alt="Measured on agentmods" height="20"></a>
Per session 73 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,286 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00073 $0.03286
Opus 5 $0.00036 $0.01643
Sonnet 5 $0.00015 $0.00657
Haiku 4.5 $0.00007 $0.00329

Measured 5d ago against content hash d3630adad266, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

cloudfront-waf-hardening scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -s -o /dev/null -w "%{http_code}" https://$CF_DOMAIN/health/liveliness
skills/cloudfront-waf-hardening/SKILL.md · 356 lines

How it starts

The opening of the file, as written. The whole thing — 356 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CloudFront + WAF Hardening

Lock down an ALB-backed service so it is only reachable through CloudFront, with WAF path-level access control.

When to Activate

  • Deploying LiteLLM (or any API proxy) on EKS/ECS behind an ALB
  • User asks to "add CloudFront" or "lock down ALB" or "hide the ALB"
  • Hardening an existing internet-facing ALB
  • Restricting public access to API-only paths (no Admin UI)

Architecture

Client (HTTPS)
  |
  v
CloudFront Distribution
  |  adds X-CloudFront-Secret header
  v
ALB (HTTP :80, SG = CloudFront prefix list only)
  |
WAF Web ACL (default: Block)
  |  Rule: Allow IF secret header matches AND path in whitelist
  v
Backend (EKS Pod / ECS Task / EC2)

Three layers of defense:

  1. ALB Security Group — only allows CloudFront IP ranges (AWS managed prefix list)
  2. WAF header verification — blocks requests without the correct X-CloudFront-Secret
  3. WAF path whitelist — even valid CloudFront requests are blocked if the path is not allowed

Prerequisites

  • AWS CLI v2 with sufficient IAM permissions (wafv2, cloudfront, ec2, elasticloadbalancing)
  • An existing ALB with a known ARN
  • The ALB's Security Group ID
  • (Optional) An existing K8s Ingress group if using EKS ALB Controller

Step-by-Step Procedure

Step 1: Generate a CloudFront Secret

CF_SECRET=$(python3 -c "import secrets; print(secrets.token_urlsafe(32))")
echo "CloudFront Secret: $CF_SECRET"

Store this value securely. It will be configured in both CloudFront (origin header) and WAF (match rule).

Step 2: Create CloudFront Distribution

Generate the distribution config with a custom origin header:

ALB_DNS="<alb-dns-name>"  # e.g. k8s-myapp-abc123.region.elb.amazonaws.com

python3 -c "
import json

config = {
    'CallerReference': '$(date +%s)',
    'Comment': 'Hardened distribution for ALB',
    'Enabled': True,
    'Origins': {
        'Quantity': 1,
        'Items': [{
            'Id': 'alb-origin',
            'DomainName': '$ALB_DNS',
            'CustomOriginConfig': {
                'HTTPPort': 80,
                'HTTPSPort': 443,
                'OriginProtocolPolicy': 'http-only',
                'OriginReadTimeout': 60,
                'OriginKeepaliveTimeout': 5
            },
            'CustomHeaders': {
                'Quantity': 1,
                'Items': [{
                    'HeaderName': 'X-CloudFront-Secret',
                    'HeaderValue': '$CF_SECRET'
                }]
            }
        }]
    },
    'DefaultCacheBehavior': {
        'TargetOriginId': 'alb-origin',
        'ViewerProtocolPolicy': 'redirect-to-https',
        'AllowedMethods': {
            'Quantity': 7,
            'Items': ['GET','HEAD','OPTIONS','PUT','POST','PATCH','DELETE'],
            'CachedMethods': {'Quantity': 2, 'Items': ['GET','HEAD']}
        },
        'CachePolicyId': '4135ea2d-6df8-44a3-9df3-4b5a84be39ad',
        'OriginRequestPolicyId': '216adef6-5c7f-47e4-b989-5492eafa07d3',
        'Compress': True
    },
    'PriceClass': 'PriceClass_200'
}

with open('/tmp/cf-dist.json', 'w') as f:
    json.dump({'DistributionConfig': config}, f)
print('Config written to /tmp/cf-dist.json')
"

aws cloudfront create-distribution --cli-input-json file:///tmp/cf-dist.json

Read the full file on GitHub · 356 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 356 lines · 73 tokens per session scan A d3630adad266

Subscribe to this mod's changes

cloudfront-waf-hardening is a skill published in the GitHub repository cncoder/serverless-litellm (2 stars, last pushed 1mo ago), licensed MIT. It adds 73 tokens to every session and 3,286 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

build-ami

Use when building, compiling, or publishing the Nexus Gateway AWS AMI / single-instance appliance (the nexus-ami/ Packer image) and registering it to AWS. Covers the full pipeline (Go cross-compile + UI + Prisma + Packer), the EC2 vCPU-quota trap that makes the default m5.4xlarge fail with VcpuLimitExceeded on fresh…

AlphaBitCore/nexus-gateway · 143 tokens

aws-bedrock-custom-model-import-mcp

Manage custom models in Bedrock.

Friz-zy/ai-capability-registry · 16 tokens

linux-agent-deploy

Install, enroll, start, and troubleshoot the Linux Nexus Agent on a target host until it connects to the Hub, installs the iptables redirect chain, listens on 19080, and produces trafficevent rows. Encodes every real failure mode hit deploying to an Ubuntu server and a kernel-6.17 Docker desktop on a censored (GFW)…

AlphaBitCore/nexus-gateway · 222 tokens

ecs-modernize

Assess an existing app (VMware/EC2) by source code analysis for the replatform vs rearchitect decision, and execute the approved migration onto Amazon ECS. Scope: assessment, strategy decision, migration execution. Covers: source code analysis; language/framework detection (Java, .NET, Spring, Struts, WebSphere…

aws-samples/sample-apex-skills · 230 tokens

eks-security

EKS security and compliance assessment — 7-layer hardening stack, CIS/HIPAA/PCI/FedRAMP/SOC2/GDPR audit prep, and 30/60/90 roadmap. Covers OS/AMI selection (Bottlerocket, AL2023, RHEL, Ubuntu), identity (EKS Pod Identity vs IRSA, Access Entries vs aws-auth), workload security (Pod Security Admission, Kyverno/OPA…

aws-samples/sample-apex-skills · 221 tokens

ecs-build

Use when building Amazon ECS infrastructure with Terraform, generating apply-ready code for ECS clusters, services, and task definitions across three capacity models — Fargate (FARGATESPOT as capacity provider), EC2 Auto Scaling group providers, and ECS Managed Instances. Covers rolling/blue-green/linear/canary…

aws-samples/sample-apex-skills · 226 tokens