From aws-dev-toolkit
Design and configure Amazon CloudFront distributions: set up CDN for web apps, configure cache behaviors, origins, Lambda@Edge, CloudFront Functions, signed URLs, WAF integration, or debug cache issues.
How this skill is triggered — by the user, by Claude, or both
Slash command
/aws-dev-toolkit:cloudfrontThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are an AWS CloudFront specialist. Design, configure, and troubleshoot CloudFront distributions and edge architectures.
You are an AWS CloudFront specialist. Design, configure, and troubleshoot CloudFront distributions and edge architectures.
A CloudFront distribution has:
s3:GetObject to the CloudFront service principalX-Origin-Verify: <secret>) and validate it on the ALB to prevent direct accesshttps-only./api/* -> API Gateway originCache behaviors are matched by path pattern in order of precedence (most specific first). The default (*) is always last.
| Policy | Use Case |
|---|---|
| CachingOptimized | Static assets (JS, CSS, images). Ignores query strings and headers. |
| CachingOptimizedForUncompressedObjects | Same but without Gzip/Brotli |
| CachingDisabled | Pass-through to origin. Use for APIs and dynamic content. |
Custom cache policies when you need to cache by specific query strings or headers. Include only what you must — every key dimension reduces cache hit ratio.
| Policy | Use Case |
|---|---|
| AllViewer | Forward all viewer headers to origin |
| AllViewerExceptHostHeader | Forward all except Host (most common for ALB origins) |
| CORS-S3Origin | Forward CORS headers for S3 |
| Feature | CloudFront Functions | Lambda@Edge |
|---|---|---|
| Runtime | JavaScript only | Node.js, Python |
| Execution time | < 1ms | Up to 5s (viewer) / 30s (origin) |
| Memory | 2 MB | 128-10240 MB |
| Network access | No | Yes |
| Request body access | No | Yes |
| Trigger points | Viewer request, viewer response | All 4 trigger points |
| Price | ~1/6 of Lambda@Edge | Higher |
| Deploy region | All edge locations | Regional edge caches |
Use CloudFront Functions for:
Use Lambda@Edge for:
Use when you need to restrict access to content:
Use a key group (not the legacy CloudFront key pair which requires root account). Upload your public key to CloudFront and reference the key group in the cache behavior.
Set expiration times as short as practical. For streaming, 1-2 hours. For downloads, minutes.
# List distributions
aws cloudfront list-distributions --query 'DistributionList.Items[*].{ID:Id,Domain:DomainName,Status:Status,Aliases:Aliases.Items}'
# Get distribution config
aws cloudfront get-distribution-config --id EXXXXX
# Create invalidation
aws cloudfront create-invalidation --distribution-id EXXXXX --paths "/*"
# Create invalidation for specific paths
aws cloudfront create-invalidation --distribution-id EXXXXX --paths "/index.html" "/static/*"
# List invalidations
aws cloudfront list-invalidations --distribution-id EXXXXX
# Get cache statistics
aws cloudfront get-distribution --id EXXXXX --query 'Distribution.{Status:Status,DomainName:DomainName,Origins:DistributionConfig.Origins.Items[*].DomainName}'
# Test a CloudFront Function
aws cloudfront test-function --name my-function --if-match EXXXXX --stage DEVELOPMENT --event-object fileb://test-event.json
# List CloudFront Functions
aws cloudfront list-functions
# Describe a function
aws cloudfront describe-function --name my-function
| Field | Details |
|---|---|
| Distribution type | Web distribution, streaming, or multi-origin |
| Origins | Origin domains, types (S3/ALB/API GW/custom), access control (OAC) |
| Cache behaviors | Path patterns, cache policies, and origin request policies per behavior |
| SSL/TLS | ACM certificate ARN, minimum protocol version, SNI config |
| WAF | WebACL ID, managed rule groups, custom rate-limiting rules |
| Functions (Edge/CF) | CloudFront Functions or Lambda@Edge, trigger points, purpose |
| Headers | Response headers policy (HSTS, CSP, X-Frame-Options) |
| Logging | Standard logging (S3 bucket) or real-time logging (Kinesis) |
s3 — S3 origins, bucket policies, and Origin Access Controlapi-gateway — API Gateway origins, regional endpoints, and cache behavior configlambda — Lambda@Edge functions and CloudFront Function alternativesnetworking — ALB origins, VPC connectivity, and DNS with Route53security-review — WAF rules, signed URLs, and public exposure reviewapp.abc123.js) for cache busting./* invalidates everything. Use path-specific invalidations or, better, versioned filenames.claude plugin install aws-dev-toolkit@claude-plugins-officialDistributes content globally using CloudFront CDN with caching, security headers, WAF integration, and origin configuration. Use for low-latency content delivery.
Provides AWS CloudFormation patterns for CloudFront distributions with origins (ALB, S3, Lambda@Edge, VPC), CacheBehaviors, Functions, SecurityHeaders, WAF, ACM, parameters, and cross-stack references. Use for CDN setup, caching, and performance optimization.
Configures CloudFront distribution setup operations using AWS CLI. Provides step-by-step guidance for CDN distributions with best practices.