AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides domain expertise for managing Amazon CloudFront distributions. It covers the full lifecycle of content delivery, from initial architectural decisions and distribution creation to securing origins and content, managing TLS certificates, and configuring traffic observability. The skill acts as a router, directing users to specific reference procedures for tasks such as setting up multi-tenant distributions, implementing origin access control, or choosing between standard and real-time logging. It emphasizes that CloudFront and its associated ACM certificates must be managed in the us-east-1 region.
What it does
- Guides decisions on when to use CloudFront and how it integrates with other AWS services.
- Manages custom domain TLS certificates via ACM in us-east-1.
- Configures origin protection using OAC, VPC origins, and mTLS.
- Secures content delivery with signed URLs, cookies, and geographic restrictions.
- Sets up standard and real-time logging for traffic observability.
- Supports multi-tenant distribution configurations for shared settings.
When to use it
- When you need to create or configure a CloudFront distribution.
- When you need to secure your origin so it is only reachable via CloudFront.
- When you need to manage custom domain certificates for your distribution.
- When you need to restrict content access based on identity, location, or tokens.
- When you need to analyze traffic patterns using standard or real-time logs.
Advantages
- Provides structured procedures for complex configurations like multi-tenant setups.
- Clarifies the distinction between origin protection and content security.
- Centralizes guidance on AWS service integrations like WAF and Lambda@Edge.
- Ensures correct regional configuration for ACM certificates.
- Offers clear decision frameworks for choosing logging strategies.
Usage examples
- “How do I restrict my S3 origin so it can only be accessed through CloudFront?”
- The agent will guide you through the protecting-your-origins reference to implement Origin Access Control (OAC) or VPC origins.
- “Should I use standard or real-time logs for my CloudFront distribution?”
- The agent will help you choose based on your need for complete audit records versus fast, sampled anomaly detection.
- “I am getting an error when attaching my ACM certificate to CloudFront.”
- The agent will verify if your certificate was requested in us-east-1 and provide steps to correct the region if necessary.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/aws/cloudfront/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip cloudfront.zip -d .agents/skills
Documentation by AWS
Amazon CloudFront
Overview
Domain expertise for configuring Amazon CloudFront content delivery: deciding when to use CloudFront and how it fits the wider architecture, managing custom-domain certificates and multi-tenant distributions, protecting origins, securing content, and observing traffic.
This skill is a router. Each customer task maps to a procedure file under references/. Read the
matching reference in full before acting, then follow its constraints and steps. The reference
files are self-contained: each carries its own decision tables, constraints, procedure, and
troubleshooting.
Execute commands using the AWS MCP server when connected (sandboxed execution, audit logging,
observability). Fall back to the AWS CLI otherwise. CloudFront is a global service; its API calls
and the AWS Certificate Manager (ACM) certificates it uses are made in us-east-1 regardless of
where the customer's application runs.
Which CloudFront task do you need?
| Goal | Reference |
|---|---|
| Decide whether CloudFront is the right layer, see how it integrates, create a distribution, tune caching, or choose pricing | when to use CloudFront |
| Serve a custom domain over HTTPS, manage ACM certificates, or run many domains with a certificate per tenant | managing certificates with CloudFront |
| Make CloudFront the only way to reach the origin (S3 OAC, VPC origins, origin mutual TLS, security groups) | protecting your origins |
| Limit who can view content by identity, location, client certificate, or auth token | securing your content |
| Get visibility into traffic with standard and real-time logs, and analyze them | CloudFront observability |
| Serve multiple domains through shared configuration with per-tenant customization (SaaS, platform) | multi-tenant distributions |
Routing notes
Choosing the layer and creating a distribution vs the rest. Whether CloudFront is the right entry layer, what it integrates with, creating a distribution, caching, and pricing live in the when-to-use reference. The other references assume a distribution exists and configure one aspect of it.
Protecting origins vs securing content. Locking the origin so it is reachable only through CloudFront (OAC, VPC origins, origin mTLS) is the protecting-your-origins reference. Restricting which viewers can see content (signed URLs and cookies, geographic restrictions, viewer mTLS, edge token validation) is the securing-your-content reference. They are paired: a content control only holds when the origin is also locked.
Viewer mTLS vs origin mTLS. Authenticating the client to CloudFront (viewer mTLS) is content security. Authenticating CloudFront to the origin (origin mTLS) is origin protection. Different controls, different references.
Custom domain certificate vs Route 53 DNS cutover. Requesting and validating the ACM certificate and adding the alternate domain name is the managing-certificates reference here. Pointing the domain's DNS at the distribution, including the zone apex alias and any failover, is Route 53 DNS work (see the
route53skill).
Cross-service work
Pointing a custom domain's DNS at a CloudFront distribution, or failing over between distributions with Route 53 records, is cross-service work spanning CloudFront and Route 53. Use this skill for the CloudFront-side configuration only.
Additional Resources
Files
- ATTRIBUTION.mdAdded by AutoGineer931 B
- LICENSELicence file added by AutoGineer9.9 KiB
- NOTICELicence file added by AutoGineer67 B
- SKILL.md5.1 KiB
- references/cloudfront-observability.md10.5 KiB
- references/managing-certificates-with-cloudfront.md13.8 KiB
- references/multi-tenant-distributions.md13.3 KiB
- references/protecting-your-origins.md12.6 KiB
- references/securing-your-content.md14.9 KiB
- references/when-to-use-cloudfront.md15.4 KiB
references/when-to-use-cloudfront.md
When to Use CloudFront, and How It Fits the Architecture
Overview
Domain expertise for deciding whether Amazon CloudFront is the right entry layer for a workload, what it integrates with, how to create a first distribution and choose the origin, how caching works, when edge logic belongs in CloudFront Functions versus Lambda@Edge, and how to choose between pay-as-you-go and Flat Rate Pricing (FRP).
CloudFront is a global content delivery network of hundreds of edge locations worldwide that does three jobs at once: it accelerates delivery by caching and terminating viewer connections close to users, it absorbs and blocks Layer 3/4 distributed denial-of-service (DDoS) attacks at the edge, and it is the attachment point for the edge security and compute stack (AWS WAF, AWS Shield, CloudFront Functions, Lambda@Edge, Amazon Route 53, AWS Certificate Manager, and origins). It serves more than media: cacheable static assets, dynamic web pages, REST and GraphQL APIs, and large file downloads all run through it. For dynamic traffic and APIs, CloudFront improves performance through TLS termination closer to the end user, persistent connection pooling to origins (reducing TCP/TLS handshake overhead), and optimized network paths between edge locations and origins.
Every standard CloudFront distribution is assigned a default domain name (e.g., d111111abcdef8.cloudfront.net) that can be used immediately for testing without configuring a custom domain or certificate. Multi-tenant distributions do not have a default test domain.
Does not cover locking the origin (see protecting-your-origins), restricting who can view content (see securing-your-content), custom domains and certificates (see managing-certificates-with-cloudfront), logging and analysis (see cloudfront-observability), or the Route 53 DNS cutover (a Route 53 step; see the route53 skill).
Execute commands using the AWS MCP server when connected (sandboxed execution, audit logging,
observability). Fall back to the AWS CLI otherwise. CloudFront is a global service; its API calls
and ACM certificates are made in us-east-1 regardless of where the application runs.
Table of Contents
Overview
Decision: is CloudFront the right layer
Decision: origin type
Decision: CloudFront Functions vs Lambda@Edge
Caching: cache behaviors and cache policies
Decision: pay-as-you-go vs Flat Rate Pricing (FRP)
Procedure
Troubleshooting
Security Considerations
Additional Resources
Decision: is CloudFront the right layer
| Signal | CloudFront fit |
|---|---|
| Cacheable or static content, or dynamic web and API traffic to accelerate | Yes. Caching and edge termination reduce latency and origin load |
| Need Layer 3/4 DDoS absorption and Layer 7 filtering at the edge | Yes. Shield is built in; AWS WAF attaches to the distribution |
| HTTP and HTTPS only | Yes. For non-HTTP (TCP/UDP) entry, use Global Accelerator instead |
| Static IP entry point partners allowlist, or sub-minute failover | No. Use Global Accelerator |
Constraints:
You MUST recognize web, API, and download workloads as valid CloudFront use cases, not just media
You MUST explain that CloudFront is the attachment point for AWS WAF, Shield, CloudFront Functions, Lambda@Edge, Route 53, and the ACM certificate, so the edge is designed once
You SHOULD redirect non-HTTP protocols, static-IP entry, or sub-minute failover needs to Global Accelerator
Decision: origin type
| Origin | Approach |
|---|---|
| Amazon S3 bucket (private) | Standard bucket origin with origin access control (default). See protecting-your-origins |
| Amazon S3 that must also be public outside CloudFront | S3 website endpoint as a custom origin (exception only) |
| ALB, NLB, or EC2 in a private subnet | VPC origin. See protecting-your-origins |
| Public or on-premises HTTP origin | Custom origin, optionally with origin mutual TLS. See protecting-your-origins |
Constraints:
You MUST default an S3 origin to a standard bucket origin with origin access control, reserving the website endpoint for when the site must also be public outside CloudFront
You MUST surface VPC origins for an ALB, NLB, or EC2 origin in a private subnet rather than advising a move to a public subnet
Decision: CloudFront Functions vs Lambda@Edge
| Need | Choose |
|---|---|
| Lightweight viewer-facing transform: URL rewrite, header manipulation, redirect, token check | CloudFront Functions (viewer-request, viewer-response; sub-millisecond) |
| Network access, or origin-request / origin-response events, or a larger runtime | Lambda@Edge (higher latency and cost) |
Constraints:
You MUST match the customer's edge logic to the right tool: CloudFront Functions run only on viewer-request and viewer-response events
You MUST route logic that needs network access or origin-facing events to Lambda@Edge
You MUST publish a CloudFront function to the LIVE stage before it can be associated with a distribution
Caching: cache behaviors and cache policies
A cache policy holds the time to live (TTL) values and the cache-key definition; the cache behavior points at the policy. TTLs are set on the policy, not directly on the behavior.
Constraints:
You MUST attach a cache policy to the behavior and explain the policy, not the behavior, holds the TTLs and cache key
You SHOULD reach for a managed cache policy for standard cases and reserve custom policies for when the cache key truly differs
You MUST warn that a minimum TTL above zero overrides origin
no-cache,no-store, andprivatedirectives for at least that durationYou SHOULD add path-pattern cache behaviors (the default behavior is evaluated last) when rules differ per path, for example a long-TTL policy on
*.jpgand a no-cache policy on/api/*
Decision: pay-as-you-go vs Flat Rate Pricing (FRP)
| Option | Use when |
|---|---|
| Pay-as-you-go (per distribution) | Variable or low traffic; want granular per-dimension billing |
| Flat Rate Pricing (FRP) | Predictable, sustained high-volume traffic with a minimum monthly commitment; lower per-GB rates than pay-as-you-go with a fixed monthly commitment and overage at pay-as-you-go rates |
Constraints:
You SHOULD surface FRP when the customer describes sustained, predictable high-volume traffic, and point them to the CloudFront pricing page or their AWS account team for the current minimum monthly commitment rather than quoting a specific threshold (commitment levels can change)
You MUST note customers can move existing resources to FRP through the CloudFront console
You MUST note FRP includes a fixed monthly commitment with overage charged at pay-as-you-go rates
You SHOULD note FRP coexists with pay-as-you-go, which stays available per distribution
Procedure
Overview
This procedure creates a distribution, chooses the origin, sets the cache behavior, optionally chooses a pricing plan, and surfaces the console link to verify.
Parameters
origin_domain (required): The origin (S3 bucket, ALB/NLB/EC2, or custom HTTP origin).
origin_type (required):
s3,vpc-origin, orcustom.default_root_object (optional): For example
index.html.
Constraints for parameter acquisition:
You MUST ask for the origin and its type upfront
You MUST confirm whether the workload needs non-HTTP protocols before recommending CloudFront
Steps
1. Verify dependencies
Constraints:
You MUST confirm credentials with
aws sts get-caller-identityYou MUST confirm CloudFront is the right layer (HTTP/HTTPS, caching or edge security value)
2. Create the distribution and choose the origin
Constraints:
You MUST create the distribution with the chosen origin and let CloudFront set the default cache behavior. For an S3 origin you MUST first create an origin access control (OAC) — see protecting-your-origins for the
create-origin-access-controlcall — and reference its id viaOriginAccessControlIdin the create call below (replace{oac_id}), so the origin is locked from the start rather than created reachable-and-then-hardened. Do not embed a static managed cache policy id; look up the currentManaged-CachingOptimizedpolicy by name and use its id forCachePolicyId(managed policy ids can change):# resolve the managed CachingOptimized cache policy id (do not hardcode a UUID): aws cloudfront list-cache-policies --type managed \ --query "CachePolicyList.Items[?CachePolicy.CachePolicyConfig.Name=='Managed-CachingOptimized'].CachePolicy.Id | [0]" --output text aws cloudfront create-distribution --distribution-config '{"CallerReference":"dist-2024-01","Comment":"","Origins":{"Quantity":1,"Items":[{"Id":"s3-origin","DomainName":"{origin_domain}","OriginAccessControlId":"{oac_id}","S3OriginConfig":{"OriginAccessIdentity":""}}]},"DefaultCacheBehavior":{"TargetOriginId":"s3-origin","ViewerProtocolPolicy":"redirect-to-https","CachePolicyId":"{cache_policy_id}"},"DefaultRootObject":"index.html","Enabled":true}'You MUST default an S3 origin to a standard bucket origin and complete origin locking via the protecting-your-origins workflow: attach the OAC referenced above, write the scoped bucket policy, and keep S3 Block Public Access on, so the origin is never reachable directly
You MUST enable standard logging on the distribution immediately after creation (it is not set by the create call above), since without it there is no audit or forensic trail; see the cloudfront-observability reference for the logging configuration
You MUST set the viewer protocol policy to redirect-HTTP-to-HTTPS (or HTTPS-only) and the origin protocol policy to HTTPS-only for custom origins, ensuring encryption in transit end-to-end
You SHOULD recommend attaching an AWS WAF web ACL with baseline rules (the AWS Managed Rules Core Rule Set and Known Bad Inputs rule group) to any public-facing distribution for Layer 7 defense in depth
You SHOULD attach an AWS WAF rate-based rule for API origins, since CloudFront caching does not shield an origin from unthrottled dynamic or API requests
You MUST attach a response headers policy with browser security headers (HSTS, CSP, X-Frame-Options, X-Content-Type-Options) as a secure default; the AWS managed
SecurityHeadersPolicyis a starting pointYou MUST capture the distribution ID and the assigned
cloudfront.netdomain from the response
3. Tune caching if rules differ per path
Constraints:
You SHOULD attach a managed cache policy for the default behavior and add path-pattern behaviors only when the customer needs different rules per path
You MUST keep the minimum TTL at zero unless the customer has a reason to force caching past origin directives
4. Choose a pricing model if asked
Constraints:
You SHOULD present FRP when the customer raises cost predictability or attack exposure, otherwise leave pay-as-you-go in place
5. Wait for deployment and surface the console link
Constraints:
You MUST set the expectation that the distribution must reach
Deployedacross edge locations before it serves content, so errors on thecloudfront.netURL right after creation are expectedYou MUST present the distribution detail console link, filling
{distributionId}from the API response:https://us-east-1.console.aws.amazon.com/cloudfront/v4/home?region=us-east-1#/distributions/{distributionId}
Example
Example input
{
"origin_domain": "my-private-site.s3.us-east-1.amazonaws.com",
"origin_type": "s3",
"default_root_object": "index.html"
}Example output
Created distribution E1ABCDEF2GHIJK with a standard S3 origin and a managed cache policy on the default behavior.
Distribution is deploying; the cloudfront.net URL returns errors until it reaches Deployed.
Verify in the console:
https://us-east-1.console.aws.amazon.com/cloudfront/v4/home?region=us-east-1#/distributions/E1ABCDEF2GHIJKTroubleshooting
The cloudfront.net URL returns errors right after creation
The distribution has not finished deploying across edge locations. Wait for Deployed status, then
test again.
The S3 origin serves errors or is publicly reachable
The origin type or locking is wrong. Default to a standard bucket origin with origin access control (see protecting-your-origins), not a website endpoint.
Cannot find the per-file TTL fields on the cache behavior
TTLs and the cache key live on a cache policy the behavior points at, not on the behavior itself. Attach a cache policy and set the TTLs there.
CloudFront keeps serving stale content despite origin no-cache headers
A minimum TTL above zero overrides origin no-cache, no-store, and private directives. Set the
minimum TTL to zero.
A function association fails right after writing the code
A CloudFront function must be published to the LIVE stage before it can be associated. Publish it first.
The workload needs UDP or a static IP entry point
CloudFront serves HTTP and HTTPS only. Use Global Accelerator for non-HTTP protocols, a static-IP entry point, or sub-minute failover.
Security Considerations
Enable logging from creation. Without standard logging there is no audit or forensic trail for the distribution; enable it at creation time (see cloudfront-observability).
Rate-limit API origins. Caching does not protect an origin from unthrottled dynamic or API traffic; attach an AWS WAF rate-based rule to API distributions.
Enforce a minimum TLS version. Set the viewer protocol policy to redirect-HTTP-to-HTTPS (or HTTPS-only) and, when adding a custom domain, set the minimum protocol version to a current strong TLS 1.2-or-higher security policy rather than relying on the default — choose the newest TLS 1.2+ policy CloudFront offers rather than a hardcoded string (see managing-certificates-with-cloudfront).
Do not leave the origin unlocked. A distribution whose origin is directly reachable lets viewers bypass the edge entirely; lock the origin (see protecting-your-origins).
Audit the management plane with CloudTrail. Request access logs do not record who changed the distribution. Enable AWS CloudTrail to track CloudFront management API calls (
cloudfront:CreateDistribution,cloudfront:UpdateDistribution) for a compliance and forensic audit trail.
Additional Resources
What is Amazon CloudFront? (Amazon CloudFront Developer Guide)
Use various origins with CloudFront distributions (Amazon CloudFront Developer Guide)
Use managed cache policies (Amazon CloudFront Developer Guide)
Customize at the edge with CloudFront Functions and Lambda@Edge (Amazon CloudFront Developer Guide)
CloudFront flat-rate pricing plans (Amazon CloudFront Developer Guide)
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs an MCP server
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- AWS
- Publisher
- AWS (Official)
- Source
- aws/agent-toolkit-for-aws · skills/specialized-skills/networking-and-content-delivery-skills/cloudfront · commit 0a218f8
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- NOTICE (added by AutoGineer from NOTICE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by AWS.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download cloudfront.zip