When to use Amazon Cloudfront or S3

前端 未结 10 687
鱼传尺愫
鱼传尺愫 2020-12-12 08:43

Are there use cases that lend themselves better to Amazon cloudfront over s3 or the other way around? I\'m trying to understand the difference between the 2 through examples

10条回答
  •  眼角桃花
    2020-12-12 09:03

    Another major difference is that CloudFront allows you to mirror the site on your server. Cloudfront then caches the files such as images, mp3 or video using its content delivery network.

    This saves you having to duplicate your assets as you would when you use Amazon S3.

    However, after a file expires, CloudFront will fetch it again from your live site (at cost). So cloud front is best for frequently accessed files, and less so for infrequently accessed ones.

    One way to set the file expiry for apache is in .htaccess. For example

    
    Header set Cache-Control "max-age=648000, private"
    
    

提交回复
热议问题