Pre-Signed S3 URLs with Cloudfront/CDN

≡放荡痞女 提交于 2019-12-03 12:00:33

问题


Is it possible to generate pre-signed URLs for CDNs (i.e., CloudFront?), or can I append pre-signed URL parameters to a CloudFront URL to use instead?

Example:

string url = amazonS3Client.generatePresignedUrl(generatePresignedUrlRequest);

returns:

url = "https://bucket-name.s3.amazonaws.com/file.txt?AWSAccessKeyId=XXXXXXXXXXXXXXXXXXXX&Expires=1111111111&Signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Can I take the URL parameters and append to corresponding CloudFront URL:

https://00000000000000.cloudfront.net/file.txt?AWSAccessKeyId=XXXXXXXXXXXXXXXXXXXX&Expires=1111111111&Signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Will this work to allow download of the file?


回答1:


FYI if you only want the network optimization, and not the edge caching, you can also consider using "Amazon S3 Transfer Acceleration": https://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html

This allows you to keep using S3 signatures, rather than having to implement Cloudfront signatures.

See my answer here for more details: https://stackoverflow.com/a/54139603/8046487



来源:https://stackoverflow.com/questions/40093881/pre-signed-s3-urls-with-cloudfront-cdn

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!