[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6EEDJMM2JPE0KYRF43VDNSB":3,"skill-same:01M6EEDJMM2JPE0KYRF43VDNSB":74},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":17,"categories":18,"keywords":29,"publishedAt":33,"linkOnly":34,"markdownContent":35,"markdownBody":35,"frontMatter":36,"refName":37,"commitSha":38,"skillDirectory":39,"forksCount":40,"repositoryHtmlUrl":41,"repositoryHomepageUrl":42,"ownerHtmlUrl":43,"ownerBlogUrl":7,"ownerDescription":44,"updatedAt":45,"install":46,"resources":59},"01M6EEDJMM2JPE0KYRF43VDNSB","aws-cloudfront","AWS CloudFront CDN 配置",null,"","ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FTerminalSkills\u002Fskills\u002Faws-cloudfront\u002FSKILL.md",[19,24],{"categoryNo":20,"categoryName":21,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8BT9F3Z67AB1M6CHA8X75WW","云架构师","PROFESSION","适用职业",{"categoryNo":25,"categoryName":26,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8CG1FNBAZJV3F8NP9PDN8VJ","云平台运维与资源操作","SCENARIO","使用场景",[30,31,32],"aws","aws cloudfront","cloudfront","2026-11-10 10:12:30",false,"# AWS CloudFront\n\nAmazon 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.\n\n## Core Concepts\n\n- **Distribution** — a CloudFront deployment with origins and behaviors\n- **Origin** — the source of content (S3, ALB, custom HTTP server)\n- **Cache Behavior** — rules for how requests are handled per URL pattern\n- **Origin Access Control (OAC)** — restricts S3 access to CloudFront only\n- **Lambda@Edge** — run code at edge locations on request\u002Fresponse\n- **Invalidation** — remove cached content before TTL expires\n\n## Creating a Distribution\n\n```json\n\u002F\u002F dist-config.json — CloudFront distribution for S3 static site + ALB API\n{\n  \"CallerReference\": \"my-app-2024\",\n  \"Comment\": \"My App CDN\",\n  \"DefaultCacheBehavior\": {\n    \"TargetOriginId\": \"s3-static\",\n    \"ViewerProtocolPolicy\": \"redirect-to-https\",\n    \"CachePolicyId\": \"658327ea-f89d-4fab-a63d-7e88639e58f6\",\n    \"Compress\": true,\n    \"AllowedMethods\": [\"GET\", \"HEAD\"],\n    \"CachedMethods\": [\"GET\", \"HEAD\"]\n  },\n  \"Origins\": {\n    \"Quantity\": 2,\n    \"Items\": [\n      {\n        \"Id\": \"s3-static\",\n        \"DomainName\": \"my-app-assets.s3.us-east-1.amazonaws.com\",\n        \"OriginAccessControlId\": \"EABCDEF123456\",\n        \"S3OriginConfig\": {\"OriginAccessIdentity\": \"\"}\n      },\n      {\n        \"Id\": \"alb-api\",\n        \"DomainName\": \"app-alb-123456.us-east-1.elb.amazonaws.com\",\n        \"CustomOriginConfig\": {\n          \"HTTPPort\": 80,\n          \"HTTPSPort\": 443,\n          \"OriginProtocolPolicy\": \"https-only\"\n        }\n      }\n    ]\n  },\n  \"CacheBehaviors\": {\n    \"Quantity\": 1,\n    \"Items\": [{\n      \"PathPattern\": \"\u002Fapi\u002F*\",\n      \"TargetOriginId\": \"alb-api\",\n      \"ViewerProtocolPolicy\": \"https-only\",\n      \"CachePolicyId\": \"4135ea2d-6df8-44a3-9df3-4b5a84be39ad\",\n      \"OriginRequestPolicyId\": \"216adef6-5c7f-47e4-b989-5492eafa07d3\",\n      \"AllowedMethods\": [\"GET\", \"HEAD\", \"OPTIONS\", \"PUT\", \"POST\", \"PATCH\", \"DELETE\"],\n      \"CachedMethods\": [\"GET\", \"HEAD\"]\n    }]\n  },\n  \"DefaultRootObject\": \"index.html\",\n  \"Enabled\": true,\n  \"PriceClass\": \"PriceClass_100\",\n  \"ViewerCertificate\": {\n    \"ACMCertificateArn\": \"arn:aws:acm:us-east-1:123456789:certificate\u002Fabc-123\",\n    \"SSLSupportMethod\": \"sni-only\",\n    \"MinimumProtocolVersion\": \"TLSv1.2_2021\"\n  },\n  \"Aliases\": {\"Quantity\": 1, \"Items\": [\"app.example.com\"]}\n}\n```\n\n```bash\n# Create distribution\naws cloudfront create-distribution --distribution-config file:\u002F\u002Fdist-config.json\n```\n\n## Origin Access Control\n\n```bash\n# Create OAC to restrict S3 access to CloudFront\naws cloudfront create-origin-access-control \\\n  --origin-access-control-config '{\n    \"Name\": \"my-app-oac\",\n    \"OriginAccessControlOriginType\": \"s3\",\n    \"SigningBehavior\": \"always\",\n    \"SigningProtocol\": \"sigv4\"\n  }'\n```\n\n```json\n\u002F\u002F S3 bucket policy allowing only CloudFront\n{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [{\n    \"Sid\": \"AllowCloudFront\",\n    \"Effect\": \"Allow\",\n    \"Principal\": {\"Service\": \"cloudfront.amazonaws.com\"},\n    \"Action\": \"s3:GetObject\",\n    \"Resource\": \"arn:aws:s3:::my-app-assets\u002F*\",\n    \"Condition\": {\n      \"StringEquals\": {\n        \"AWS:SourceArn\": \"arn:aws:cloudfront::123456789:distribution\u002FE1234567890\"\n      }\n    }\n  }]\n}\n```\n\n## Cache Invalidation\n\n```bash\n# Invalidate specific paths\naws cloudfront create-invalidation \\\n  --distribution-id E1234567890 \\\n  --paths '\u002Findex.html' '\u002Fstatic\u002Fapp.js' '\u002Fapi\u002Fconfig'\n```\n\n```bash\n# Invalidate everything (use sparingly — costs per path)\naws cloudfront create-invalidation \\\n  --distribution-id E1234567890 \\\n  --paths '\u002F*'\n```\n\n```bash\n# Check invalidation status\naws cloudfront list-invalidations --distribution-id E1234567890\n```\n\n## Lambda@Edge\n\n```python\n# lambda-edge\u002Fviewer-request.py — add security headers and redirect\ndef handler(event, context):\n    request = event['Records'][0]['cf']['request']\n    uri = request['uri']\n\n    # SPA routing: serve index.html for non-file paths\n    if '.' not in uri.split('\u002F')[-1]:\n        request['uri'] = '\u002Findex.html'\n\n    return request\n```\n\n```python\n# lambda-edge\u002Forigin-response.py — add security headers\ndef handler(event, context):\n    response = event['Records'][0]['cf']['response']\n    headers = response['headers']\n\n    headers['strict-transport-security'] = [{\n        'key': 'Strict-Transport-Security',\n        'value': 'max-age=63072000; includeSubDomains; preload'\n    }]\n    headers['x-content-type-options'] = [{\n        'key': 'X-Content-Type-Options',\n        'value': 'nosniff'\n    }]\n    headers['x-frame-options'] = [{\n        'key': 'X-Frame-Options',\n        'value': 'DENY'\n    }]\n\n    return response\n```\n\n## Custom Error Pages\n\n```bash\n# Configure custom error responses (SPA fallback)\naws cloudfront update-distribution \\\n  --id E1234567890 \\\n  --if-match ETAG123 \\\n  --distribution-config '...' # Include CustomErrorResponses:\n```\n\n```json\n\u002F\u002F Custom error responses for SPA routing\n{\n  \"CustomErrorResponses\": {\n    \"Quantity\": 2,\n    \"Items\": [\n      {\"ErrorCode\": 403, \"ResponsePagePath\": \"\u002Findex.html\", \"ResponseCode\": \"200\", \"ErrorCachingMinTTL\": 10},\n      {\"ErrorCode\": 404, \"ResponsePagePath\": \"\u002Findex.html\", \"ResponseCode\": \"200\", \"ErrorCachingMinTTL\": 10}\n    ]\n  }\n}\n```\n\n## Monitoring\n\n```bash\n# Get distribution details\naws cloudfront get-distribution --id E1234567890 \\\n  --query 'Distribution.[DomainName,Status,DistributionConfig.Enabled]'\n```\n\n```bash\n# Enable real-time logs\naws cloudfront create-realtime-log-config \\\n  --name app-realtime-logs \\\n  --sampling-rate 100 \\\n  --fields \"timestamp\" \"c-ip\" \"sc-status\" \"cs-uri-stem\" \"time-taken\" \\\n  --end-points '[{\"StreamType\":\"Kinesis\",\"KinesisStreamConfig\":{\"RoleARN\":\"arn:aws:iam::123456789:role\u002Fcf-realtime-logs\",\"StreamARN\":\"arn:aws:kinesis:us-east-1:123456789:stream\u002Fcf-logs\"}}]'\n```\n\n## Best Practices\n\n- Use Origin Access Control (not legacy OAI) for S3 origins\n- Enable compression for text-based assets (HTML, CSS, JS, JSON)\n- Use managed cache policies instead of custom forwarding settings\n- Invalidate sparingly — use versioned filenames (app.v2.js) instead\n- Set appropriate TTLs: long for static assets, short for dynamic content\n- Use Lambda@Edge for SPA routing, A\u002FB testing, and auth at the edge\n- Enable HTTPS everywhere with ACM certificates (must be in us-east-1)\n",{},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002FTerminalSkills\u002Fskills\u002Faws-cloudfront",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":9,"skillName":5,"commands":47,"prompt":57,"zipAvailable":58},[48,51,54],{"tool":49,"command":50},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill aws-cloudfront",{"tool":52,"command":53},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill aws-cloudfront",{"tool":55,"command":56},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill aws-cloudfront","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FTerminalSkills\u002Fskills\u002Faws-cloudfront\u002FSKILL.md",true,[60,66,70],{"path":61,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":64,"sourceHtmlUrl":65},"references\u002FERROR-HANDLING.md","REFERENCE","参考文档",8896,"https:\u002F\u002Fgithub.com\u002FThamielis\u002F.agents\u002Fblob\u002Fmain\u002Fskills\u002Fazure-deployment-preflight\u002Freferences\u002FERROR-HANDLING.md",{"path":67,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":68,"sourceHtmlUrl":69},"references\u002FREPORT-TEMPLATE.md",7458,"https:\u002F\u002Fgithub.com\u002FThamielis\u002F.agents\u002Fblob\u002Fmain\u002Fskills\u002Fazure-deployment-preflight\u002Freferences\u002FREPORT-TEMPLATE.md",{"path":71,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":72,"sourceHtmlUrl":73},"references\u002FVALIDATION-COMMANDS.md",8379,"https:\u002F\u002Fgithub.com\u002FThamielis\u002F.agents\u002Fblob\u002Fmain\u002Fskills\u002Fazure-deployment-preflight\u002Freferences\u002FVALIDATION-COMMANDS.md",[75,84,93,102,108,114],{"skillNo":76,"name":77,"nameZh":7,"description":7,"descriptionZh":7,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":33},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[],[81,82,83],"model","model hierarchy","model hierarchy skill",{"skillNo":85,"name":86,"nameZh":7,"description":7,"descriptionZh":7,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":33},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[],[90,91,92],"MCP","zoom","zoom mcp",{"skillNo":94,"name":95,"nameZh":7,"description":7,"descriptionZh":7,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":33},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[99,100,101,91],"sdk","zoom apps sdk","apps",{"skillNo":103,"name":104,"nameZh":7,"description":7,"descriptionZh":7,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":33},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[104],{"skillNo":109,"name":110,"nameZh":7,"description":7,"descriptionZh":7,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":111,"categories":112,"keywords":113,"publishedAt":33},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[],[110],{"skillNo":115,"name":116,"nameZh":7,"description":7,"descriptionZh":7,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":33},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[116]]