Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Configure Amazon CloudFront for global content delivery. Set up distributions with S3 and ALB origins, define cache behaviors and TTLs, invalidate cached content, and use Lambda@Edge for request/response manipulation at the edge.
.claude/skills/terminalskills-aws-cloudfront/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-12 | ✗→✓ | ▲ Improved | 221% | 0% |
| case-14 | ✗→✓ | ▲ Improved | 73% | 0% |
| case-02 | ✓→✓ | = Same ✓ | 49% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 194% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 148% | 0% |
Amazon CloudFront is a global CDN that delivers content from 400+ edge locations. It caches static and dynamic content, terminates SSL, and integrates with S3, ALB, and API Gateway as origins.
json// dist-config.json — CloudFront distribution for S3 static site + ALB API { "CallerReference": "my-app-2024", "Comment": "My App CDN", "DefaultCacheBehavior": { "TargetOriginId": "s3-static", "ViewerProtocolPolicy": "redirect-to-https", "CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e58f6", "Compress": true, "AllowedMethods": ["GET", "HEAD"], "CachedMethods": ["GET", "HEAD"] }, "Origins": { "Quantity": 2, "Items": [ { "Id": "s3-static", "DomainName": "my-app-assets.s3.us-east-1.amazonaws.com", "OriginAccessControlId": "EABCDEF123456", "S3OriginConfig": {"OriginAccessIdentity": ""} }, { "Id": "alb-api", "DomainName": "app-alb-123456.us-east-1.elb.amazonaws.com", "CustomOriginConfig": { "HTTPPort": 80, "HTTPSPort": 443, "OriginProtocolPolicy": "https-only" } } ] }, "CacheBehaviors": { "Quantity": 1, "Items": [{ "PathPattern": "/api/*", "TargetOriginId": "alb-api", "ViewerProtocolPolicy": "https-only", "CachePolicyId": "4135ea2d-6df8-44a3-9df3-4b5a84be39ad", "OriginRequestPolicyId": "216adef6-5c7f-47e4-b989-5492eafa07d3", "AllowedMethods": ["GET", "HEAD", "OPTIONS", "PUT", "POST", "PATCH", "DELETE"], "CachedMethods": ["GET", "HEAD"] }] }, "DefaultRootObject": "index.html", "Enabled": true, "PriceClass": "PriceClass_100", "ViewerCertificate": { "ACMCertificateArn": "arn:aws:acm:us-east-1:123456789:certificate/abc-123", "SSLSupportMethod": "sni-only", "MinimumProtocolVersion": "TLSv1.2_2021" }, "Aliases": {"Quantity": 1, "Items": ["app.example.com"]} }
bash# Create distribution aws cloudfront create-distribution --distribution-config file://dist-config.json
bash# Create OAC to restrict S3 access to CloudFront aws cloudfront create-origin-access-control \ --origin-access-control-config '{ "Name": "my-app-oac", "OriginAccessControlOriginType": "s3", "SigningBehavior": "always", "SigningProtocol": "sigv4" }'
json// S3 bucket policy allowing only CloudFront { "Version": "2012-10-17", "Statement": [{ "Sid": "AllowCloudFront", "Effect": "Allow", "Principal": {"Service": "cloudfront.amazonaws.com"}, "Action": "s3:GetObject", "Resource": "arn:aws:s3:::my-app-assets/*", "Condition": { "StringEquals": { "AWS:SourceArn": "arn:aws:cloudfront::123456789:distribution/E1234567890" } } }] }
bash# Invalidate specific paths aws cloudfront create-invalidation \ --distribution-id E1234567890 \ --paths '/index.html' '/static/app.js' '/api/config'
bash# Invalidate everything (use sparingly — costs per path) aws cloudfront create-invalidation \ --distribution-id E1234567890 \ --paths '/*'
bash# Check invalidation status aws cloudfront list-invalidations --distribution-id E1234567890
python# lambda-edge/viewer-request.py — add security headers and redirect def handler(event, context): request = event['Records'][0]['cf']['request'] uri = request['uri'] # SPA routing: serve index.html for non-file paths if '.' not in uri.split('/')[-1]: request['uri'] = '/index.html' return request
python# lambda-edge/origin-response.py — add security headers def handler(event, context): response = event['Records'][0]['cf']['response'] headers = response['headers'] headers['strict-transport-security'] = [{ 'key': 'Strict-Transport-Security', 'value': 'max-age=63072000; includeSubDomains; preload' }] headers['x-content-type-options'] = [{ 'key': 'X-Content-Type-Options', 'value': 'nosniff' }] headers['x-frame-options'] = [{ 'key': 'X-Frame-Options', 'value': 'DENY' }] return response
bash# Configure custom error responses (SPA fallback) aws cloudfront update-distribution \ --id E1234567890 \ --if-match ETAG123 \ --distribution-config '...' # Include CustomErrorResponses:
json// Custom error responses for SPA routing { "CustomErrorResponses": { "Quantity": 2, "Items": [ {"ErrorCode": 403, "ResponsePagePath": "/index.html", "ResponseCode": "200", "ErrorCachingMinTTL": 10}, {"ErrorCode": 404, "ResponsePagePath": "/index.html", "ResponseCode": "200", "ErrorCachingMinTTL": 10} ] } }
bash# Get distribution details aws cloudfront get-distribution --id E1234567890 \ --query 'Distribution.[DomainName,Status,DistributionConfig.Enabled]'
bash# Enable real-time logs aws cloudfront create-realtime-log-config \ --name app-realtime-logs \ --sampling-rate 100 \ --fields "timestamp" "c-ip" "sc-status" "cs-uri-stem" "time-taken" \ --end-points '[{"StreamType":"Kinesis","KinesisStreamConfig":{"RoleARN":"arn:aws:iam::123456789:role/cf-realtime-logs","StreamARN":"arn:aws:kinesis:us-east-1:123456789:stream/cf-logs"}}]'
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-10 | fail→fail | 11,119 | 8,875 | -20% | 1 | 1 | 0% | 2,165 | 3,771 | +74% | 0 | 0 | — |
case-20 | fail→fail | 10,527 | 8,710 | -17% | 1 | 1 | 0% | 2,188 | 3,807 | +74% | 0 | 0 | — |
case-01 | fail→fail | 13,642 | 7,897 | -42% | 1 | 1 | 0% | 2,866 | 3,791 | +32% | 0 | 0 | — |
case-02 | pass→pass | 9,267 | 4,391 | -53% | 1 | 1 | 0% | 1,962 | 2,920 | +49% | 0 | 0 | — |
case-03 | pass→pass | 4,611 | 3,979 | -14% | 1 | 1 | 0% | 997 | 2,929 | +194% | 0 | 0 | — |
case-04 | pass→pass | 5,260 | 3,954 | -25% | 1 | 1 | 0% | 1,180 | 2,921 | +148% | 0 | 0 | — |
case-05 | pass→pass | 6,488 | 5,711 | -12% | 1 | 1 | 0% | 1,442 | 3,322 | +130% | 0 | 0 | — |
case-06 | pass→pass | 6,201 | 4,602 | -26% | 1 | 1 | 0% | 1,171 | 2,858 | +144% | 0 | 0 | — |
case-07 | pass→pass | 2,753 | 2,478 | -10% | 1 | 1 | 0% | 483 | 2,490 | +416% | 0 | 0 | — |
case-08 | pass→pass | 5,009 | 5,283 | +5% | 1 | 1 | 0% | 1,043 | 3,103 | +198% | 0 | 0 | — |
case-09 | pass→pass | 12,435 | 11,210 | -10% | 1 | 1 | 0% | 2,376 | 4,071 | +71% | 0 | 0 | — |
case-11 | pass→pass | 6,109 | 3,748 | -39% | 1 | 1 | 0% | 1,154 | 2,868 | +149% | 0 | 0 | — |
case-12 | fail→pass | 21,606 | 9,754 | -55% | 1 | 1 | 0% | 1,200 | 3,854 | +221% | 0 | 0 | — |
case-13 | pass→pass | 3,273 | 2,726 | -17% | 1 | 1 | 0% | 605 | 2,538 | +320% | 0 | 0 | — |
case-14 | fail→pass | 11,873 | 9,307 | -22% | 1 | 1 | 0% | 2,188 | 3,788 | +73% | 0 | 0 | — |
case-15 | pass→pass | 10,103 | 8,950 | -11% | 1 | 1 | 0% | 1,975 | 3,780 | +91% | 0 | 0 | — |
case-16 | pass→pass | 3,040 | 2,125 | -30% | 1 | 1 | 0% | 574 | 2,479 | +332% | 0 | 0 | — |
case-17 | pass→pass | 3,604 | 2,855 | -21% | 1 | 1 | 0% | 745 | 2,613 | +251% | 0 | 0 | — |
case-18 | pass→pass | 5,019 | 3,285 | -35% | 1 | 1 | 0% | 1,058 | 2,561 | +142% | 0 | 0 | — |
case-19 | pass→pass | 3,722 | 3,458 | -7% | 1 | 1 | 0% | 675 | 2,688 | +298% | 0 | 0 | — |
case-21 | pass→pass | 6,720 | 5,897 | -12% | 1 | 1 | 0% | 1,414 | 3,277 | +132% | 0 | 0 | — |
case-22 | pass→pass | 8,272 | 9,111 | +10% | 1 | 1 | 0% | 1,698 | 3,861 | +127% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 21 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +9 percentage points is the difference between those two pass rates over the 21 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.