I have large download files (Some are bigger than 5 GB) hosted on Amazon S3. My main server is Nginx. Amazon S3 has not public access. Files are served with signed URLs.
Is there a way a restrict bandwidth when using Amazon S3? I know there is no option on Amazon S3, but can we use Nginx as a proxy and make it from there?
I am trying to use the example from that link:
https://coderwall.com/p/rlguog/nginx-as-proxy-for-amazon-s3-public-private-files
This code block:
location ~* ^/proxy_private_file/(.*) {
set $s3_bucket 'your_bucket.s3.amazonaws.com';
set $aws_access_key 'AWSAccessKeyId=YOUR_ONLY_ACCESS_KEY';
set $url_expires 'Expires=$arg_e';
set $url_signature 'Signature=$arg_st';
set $url_full '$1$aws_access_key&$url_expires&$url_signature';
proxy_http_version 1.1;
proxy_set_header Host $s3_bucket;
proxy_set_header Authorization '';
proxy_hide_header x-amz-id-2;
proxy_hide_header x-amz-request-id;
proxy_hide_header Set-Cookie;
proxy_ignore_headers "Set-Cookie";
proxy_buffering off;
proxy_intercept_errors on;
resolver 172.16.0.23 valid=300s;
resolver_timeout 10s;
proxy_pass http://$s3_bucket$url_full;
}
What i don't understand is how can i pass the created signed URL from PHP to that Nginx Config? So i can tell Nginx to go to that signed URL as proxy.