问题
I'm making a global iOS App with AWS SDK.
And there is a function for users to get image files; only if the requester is a friend of the image files' uploader.
For this function, I use AWS S3 for storage service with private access.
And I want to use CloudFront for my users to get download files faster.
I should set the bucket name for downloading on AWS S3 SDK, but it seems that the CloudFront does not support for this bucket name.
Is AWS CloudFront only for public things with url?
回答1:
If you want to serve private content via CloudFront, you will find this doc useful http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html. Currently the AWS SDK for iOS doesn't support CloudFront directly. You need to manually sign the request. A related question is asked on AWS forum https://forums.aws.amazon.com/thread.jspa?messageID=336955.
回答2:
Have you consider making your AWS S3 bucket public, and then encrypting all of the users pictures? You could push the keys through EC2 or another service and still get the performance of CloudFront.
回答3:
However, even if you can download photos from CloudFront as indicated in https://forums.aws.amazon.com/thread.jspa?messageID=336955, it is HIGHLY not recommended to do so, because you will ship your private key pem file to the public together with your app. Yosuke said this clearly.
来源:https://stackoverflow.com/questions/30679544/is-it-impossible-to-use-aws-cloudfront-for-downloading-my-private-image-on-s3