问题
I'd like to upload image to S3 via CloudFront. If you see the document about CloudFront, you can find that cloud front offers put method for uploading to cloudFront There could be someone to ask me why i use the cloud front for uploading to S3 If you search out about that, you can find the solution
What i wanna ask is whether there is method in SDK for uploading to cloud front or not As you know , there is method "putObejct" for uploading directly to S3 but i can't find for uploading cloud front ...
please help me..
回答1:
Data can be sent through Amazon CloudFront to the back-end "origin". This is used for using a POST on web forms, to send information back to web servers. It can also be used to POST data to Amazon S3.
If you would rather use an SDK to upload data to Amazon S3, there is no benefit in sending it "via CloudFront". Instead, use the Amazon S3 APIs to upload the data directly to S3.
So, bottom line:
- If you're uploading from a web page that was initially served via CloudFront, send it through CloudFront to S3
- If you're calling an API, call S3 directly
回答2:
If the bucket's region is far away from the uploading computer you can upload faster by enabling S3 Accelerate which uploads directly through the Amazon server located closest to you and then continues sending the file from there to the bucket's actual region at an optimal route.
Have a look here.
来源:https://stackoverflow.com/questions/30394768/how-to-put-object-to-s3-via-cloudfront