InterviewHubPRO
Section Overview
Q43

Question 43 of 65

Part 4: Storage, Content Delivery & Databases (36 - 50)

66%
AWS Cloud Architecture•Part 4: Storage, Content Delivery & Databases (36 - 50)

CloudFront Signed URLs vs Signed Cookies.

In Simple Words:

  • Signed URLs: Grants temporary access to a single specific file (e.g., a one-time video download link).
  • Signed Cookies: Grants access to multiple protected files or an entire folder without altering URLs (e.g., streaming HLS video segments to an authorized subscriber).
typescript
import { getSignedUrl } from "@aws-sdk/cloudfront-signer";

const signedUrl = getSignedUrl({
  url: "https://cdn.example.com/premium-video.mp4",
  keyPairId: "K2JCJMDEHXQW5F",
  privateKey: process.env.CLOUDFRONT_PRIVATE_KEY!,
  dateLessThan: new Date(Date.now() + 1000 * 60 * 60).toISOString() // 1 hour TTL
});