AWS认证解决方案架构助理 - AWS CloudFront笔记

本文深入探讨了内容分发网络(CDN)的工作原理,包括其如何在全球范围内缓存网站内容,实现基于地理位置的快速交付。文章详细介绍了CDN的核心组件,如源站、边缘位置及分布,并解释了如何通过行为设置、无效化请求、错误页面定制等功能优化网站性能。此外,还介绍了Lambda@Edge的使用,以及如何通过限制和保护措施确保内容的安全访问。

Content Delivery Network(CDN)
Creates cached copies of your website at various edge locations around the world.

Content Delivery Network (CDN)

A CDN is a distributed network of servers which delivers web pages and content to users based on their geographical location, the origin of the webpage, and a content delivery server.

Can be used to deliver an entire website including static, dynamic and streaming.

Requests for content are served from the nearest Edge Location for the best possible performance.

Core Components
  • Origin
    The locathion where all of original files are located. For example an S3 Bucket, EC2 instance, ELB, or Route 53.

  • Edge Location
    The location where web content will be cached. This is different than an AWS Region or AZ.

Distributions

A Distribution is a collection of Edge Locations. You specific the Origin e.g. S3, EC2, ELB, Route53.

It replicates copies based on your Price class.

There are 2 types of Distributions

  1. Web (for websites)
  2. RTMP (for streaming media)
  • Behaviors
    Redirect to HTTPs, Restrict HTTP Methods, Restrict Viewer Access, Set TTLs

  • Invalidations
    You can manually invalidate cache on specific files via Invalidations

  • Error Pages
    You can server up custom error pages. e.g. 404

  • Restrictions
    You can use Geo Restriction to blacklist or whitelist specific countries.

Lambda@Edge

We use Lambda@Edge functions to override the behavior of request and responses
The 4 Available Lambda@Edge Functions

  1. View request
    When CloudFront receives a request from a viewer
  2. Origin request
    Before CloudFront forwards a request to the Origin
  3. Origin response
    When CloudFront receives a response from the origin
  4. Viewer response
    Before CloudFront returns the response to the viewer
Protection

By Default a Distribution allows every one to have access.

  • Original Identity Access (OAI)
    A virtual user identity that will be used to give your CloudFront Distribution permission to fetch a private object.

In order to use Signed URLs or Signed Cookies you need to have an OAI

  • Signed URLs (Not the same thing as S3 Presigned URL)
    A url with provided temporary access to cached objects

  • Signed Cookies
    A cookie which is passed along with the request to CloudFront. The advantage of using a Cookie is you want to provide access to multiple restricted files. e.g. Video Streaming.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值