Sunday, June 29, 2025

CloudFront | Origins.

 

In Amazon CloudFront, an origin is the source location where CloudFront fetches twtech content from when it's not already cached at an edge location.

twtech can configure one or more origins for a CloudFront distribution.

 Types of Origins

CloudFront supports multiple types of origins:

  1. Amazon S3 bucket
    • Used to serve static content (e.g., images, CSS, JS, HTML).
    • Can be configured as:
      • Public bucket
      • With Origin Access Control (OAC) for private access
  2. HTTP/HTTPS Server (Custom origin)
    • For dynamic content from:
      • EC2 instances
      • Load balancers (ALB, NLB)
      • On-premises servers
    • CloudFront connects to the origin over HTTP or HTTPS.
  3. AWS Media Services
    • Used for video streaming (e.g., AWS MediaPackage, MediaStore).
  4. Other AWS Services
    • API Gateway
    • AWS Elemental MediaPackage
    • Lambda (indirectly through API Gateway)

 Key Origin Settings

When twtech defines an origin, you specify:

  • Origin domain name: URL of the origin (e.g., example.s3.amazonaws.com)
  • Origin path (optional): Appended to the origin domain for requests
  • Origin ID: A unique identifier within your distribution
  • Protocol policy: HTTP only, HTTPS only, or match viewer
  • Custom headers (optional): Sent with origin requests

 Multiple Origins & Behaviors

  • twtech can associate different cache behaviors with different origins.
  • Example:
    • /static/* → S3 bucket
    • /api/* → ALB or API Gateway

 Example Use Case

Path Pattern

Origin Type

Description

/images/*

S3 bucket

Static images

/app/*

ALB (EC2 backend)

Dynamic web app content

/api/*

API Gateway

REST API endpoint


No comments:

Post a Comment

Kubernetes Clusters | Upstream Vs Downstream.

  The terms "upstream" and "downstream" in the context of Kubernetes clusters often refer to the direction of code fl...