aws-cloudfront
БесплатноБез исполняемых скриптовНе проверенConfigure Amazon CloudFront for global content delivery. Set up distributions with S3 and ALB origins, define cache behaviors and TTLs, invalidate cached…
Об этом скилле
AWS CloudFront
Overview
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.
Core Concepts
- Distribution — a CloudFront deployment with origins and behaviors
- Origin — the source of content (S3, ALB, custom HTTP server)
- Cache Behavior — rules for how requests are handled per URL pattern
- Origin Access Control (OAC) — restricts S3 access to CloudFront only
- Lambda@Edge — run code at edge locations on request/response
- Invalidation — remove cached content before TTL expires
Instructions
Creating a Distribution
// dist-config.json — CloudFront distribution for S3 static site + ALB API
{
"CallerReference": "northwind-shop-2026-10",
"Comment": "Northwind Shop CDN",
"DefaultCacheBehavior": {
"TargetOriginId": "s3-static",
"ViewerProtocolPolicy": "redirect-to-https",
"CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e58f6",
"ResponseHeadersPolicyId": "67f7725c-6f97-4210-82d7-5512b31e9d03",
"Compress": true,
"AllowedMethods": {
"Quantity": 2,
"Items": ["GET", "HEAD"],
"CachedMethods": {"Quantity": 2, "Items": ["GET", "HEAD"]}
}
},
"Origins": {
"Quantity": 2,
"Items": [
{
"Id": "s3-static",
"DomainName": "northwind-assets.s3.us-east-1.amazonaws.com",
"OriginAccessControlId": "E2QWRUHAPOMQZL",
"S3OriginConfig": {"OriginAccessIdentity": ""}
},
{
"Id": "alb-api",
"DomainName": "api.northwind-shop.io",
"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": {
"Quantity": 7,
"Items": ["GET", "HEAD", "OPTIONS", "PUT", "POST", "PATCH", "DELETE"],
"CachedMethods": {"Quantity": 2, "Items": ["GET", "HEAD"]}
}
}]
},
"DefaultRootObject": "index.html",
"Enabled": true,
"PriceClass": "PriceClass_100",
"ViewerCertificate": {
"ACMCertificateArn": "arn:aws:acm:us-east-1:123456789012:certificate/5f3c1a7e-2b4d-4c8e-9a10-6d2e7f0b9c11",
"SSLSupportMethod": "sni-only",
"MinimumProtocolVersion": "TLSv1.2_2025"
},
"Aliases": {"Quantity": 1, "Items": ["www.northwind-shop.io"]}
}
aws cloudfront create-distribution --distribution-config file://dist-config.json
Notes: the managed policy IDs above are Managed-CachingOptimized (658327ea-...), Managed-CachingDisabled (4135ea2d-...), Managed-AllViewer (216adef6-...) and Managed-SecurityHeadersPolicy (67f7725c-...). The AllowedMethods block nests CachedMethods and each list needs a Quantity; a plain JSON array is rejected. For an ALB origin with https-only, the origin domain must match a certificate on the load balancer, so use your own DNS name for it rather than the *.elb.amazonaws.com name. Allowed MinimumProtocolVersion values include TLSv1.2_2021, TLSv1.2_2025 and TLSv1.3_2025. CloudFront also offers flat-rate pricing plans (CDN, WAF and DDoS protection for a fixed monthly price); pay-as-you-go distributions still work as described here.
Origin Access Control
# Create OAC to restrict S3 access to CloudFront
aws cloudfront create-origin-access-control \
--origin-access-control-config '{
"Name": "northwind-assets-oac",
"OriginAccessControlOriginType": "s3",
"SigningBehavior": "always",
"SigningProtocol": "sigv4"
}'
# the response contains the Id to put in OriginAccessControlId
// 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:::northwind-assets/*",
"Condition": {
"StringEquals": {
"AWS:SourceArn": "arn:aws:cloudfront::123456789012:distribution/E1ABCDEF234567"
}
}
}]
}
Cache Invalidation
# Invalidate specific paths
aws cloudfront create-invalidation \
--distribution-id E1ABCDEF234567 \
--paths '/index.html' '/static/app.js' '/api/config'
# Invalidate everything (a wildcard counts as one path; the first 1,000 paths a month are free, then billed per path)
aws cloudfront create-invalidation \
--distribution-id E1ABCDEF234567 \
--paths '/*'
# Check invalidation status
aws cloudfront list-invalidations --distribution-id E1ABCDEF234567
Lambda@Edge
# lambda-edge/viewer-request.py — SPA routing
def h
Установить aws-cloudfront в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл aws-cloudfront?
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.
Как установить скилл aws-cloudfront?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл aws-cloudfront запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic