Presigned S3 URLs with Cloudfront

2020-03-07 04:12发布

问题:

I want to append my pre-signed URL to a CloudFront URL to use instead

any idea how to achieve this?

回答1:

Use an Amazon CloudFront Signed URL instead of attempting to use an Amazon S3 pre-signed URL with CloudFront.

See: Using Signed URLs - Amazon CloudFront



回答2:

I find the question relevant, it matches my needs. I have files stored in S3 Singapore and external consumers in Europe. AWS default bandwidth quality is quite poor (takes several minutes to download a 50 MB file for quite a few of my end users), so I'd like to optimize their network path through a layer of "dumb" CDN (not leveraging any caching, just using it for more qualitative network paths).

Turns out "Amazon S3 Transfer Acceleration" does exactly that: https://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html

============

Why Use Amazon S3 Transfer Acceleration?

You might want to use Transfer Acceleration on a bucket for various reasons, including the following:

  • You have customers that upload to a centralized bucket from all over the world.

  • You transfer gigabytes to terabytes of data on a regular basis across continents.

  • You are unable to utilize all of your available bandwidth over the Internet when uploading to Amazon S3.

Getting Started with Amazon S3 Transfer Acceleration

To get started using Amazon S3 Transfer Acceleration, perform the following steps:

  1. Enable Transfer Acceleration on a bucket

  2. Transfer data to and from the acceleration-enabled bucket by using one of the following s3-accelerate endpoint domain names:

    • bucketname.s3-accelerate.amazonaws.com – to access an acceleration-enabled bucket.

============

Remarks:

  • It's more expensive than S3 + Cloudfront. You pay normal S3 bandwidth + something like 0.04 USD / GB for the acceleration (whereas when using Cloudfront, the S3 <> Cloudfront bandwidth is free)
  • You will probably need to re-sign the URLs. Usually the host is part of the signature, and acceleration requires using a different host. However, this is just normal S3 signing, not the completely different Cloudfront signing.