mcpField
A
aws-cloudfront-cdn

aws-cloudfront-cdn

github.com/aj-geddesCloud & DevOps373475 installsUpdated 34w ago
Repository

About aws-cloudfront-cdn

A reference skill for configuring Amazon CloudFront as a content delivery network. It covers distribution setup, caching, security, and common delivery scenarios.

Key features

  1. 01AWS CLI distribution setup
  2. 02Terraform configuration guidance
  3. 03Cache and custom header settings
  4. 04HTTPS, WAF, and origin security

Use cases

  1. 01Serving static sites and assets
  2. 02Accelerating APIs and dynamic content
  3. 03Delivering video and large files

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill aws-cloudfront-cdn

After installing, type/aws-cloudfront-cdnin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
cloudfront-distribution-with-aws-cli.md
custom-headers-and-security-configuration.md
terraform-cloudfront-configuration.md
scripts/
validate-config.sh
templates/
config-starter.yaml

Details

From the project README

AWS CloudFront CDN

Table of Contents

Overview

Amazon CloudFront is a fast, globally distributed content delivery network (CDN). Cache content at edge locations worldwide to reduce latency, improve performance, and provide high availability with DDoS protection.

When to Use

  • Static website hosting and assets
  • API acceleration and dynamic content
  • Video and media streaming
  • Mobile application content
  • Large file downloads
  • Real-time data distribution
  • DDoS protection for origins
  • Origin isolation and security

Quick Start

Minimal working example:

# Create distribution for S3 origin
aws cloudfront create-distribution \
  --distribution-config '{
    "CallerReference": "myapp-'$(date +%s)'",
    "Enabled": true,
    "Comment": "My application distribution",
    "Origins": {
      "Quantity": 1,
      "Items": [{
        "Id": "myS3Origin",
        "DomainName": "mybucket.s3.us-east-1.amazonaws.com",
        "S3OriginConfig": {
          "OriginAccessIdentity": "origin-access-identity/cloudfront/ABCDEFG1234567"
        }
      }]
    },
    "DefaultCacheBehavior": {
      "AllowedMethods": {
        "Quantity": 3,
        "Items": ["GET", "HEAD", "OPTIONS"]
      },
      "ViewerProtocolPolicy": "redirect-to-https",
      "TargetOriginId": "myS3Origin",
      "ForwardedValues": {
        "QueryString": false,
// ... (see reference guides for full implementation)

Reference Guides

Detailed implementations in the references/ directory:

GuideContents
CloudFront Distribution with AWS CLICloudFront Distribution with AWS CLI
Terraform CloudFront ConfigurationTerraform CloudFront Configuration
Custom Headers and Security ConfigurationCustom Headers and Security Configuration

Best Practices

✅ DO
  • Use Origin Access Identity (OAI) for S3
  • Enable HTTPS only for viewers
  • Compress content at CloudFront
  • Set appropriate cache TTLs
  • Use cache invalidation cautiously
  • Enable WAF for protection
  • Monitor CloudWatch metrics
  • Use multiple origins for redundancy
❌ DON'T
  • Make S3 buckets public
  • Cache sensitive data
  • Use HTTP for production
  • Ignore cache headers
  • Create excessive invalidations
  • Skip WAF protection

Comments

Markdown supported