What I want is to pass somehow bucket name to aws_s3_bucket and proxy_pass. Configuration below works as expected but it is configured to single static bucket. So to access file from the defined in the config bucket, I have to call http://IP_or_hostname/file, what I want is http://IP_or_file/$bucket/file. This is based on https://github.com/anomalizer/ngx_aws_auth module which doesn't support variables as mentioned here: https://github.com/anomalizer/ngx_aws_auth/issues/49. Is it possible with Nginx?
Config:
worker_processes 1;
events {
worker_connections 1024;
}
http {
server {
listen 80;
client_max_body_size 100G;
aws_access_key 'AKI';
aws_signing_key "xyz";
aws_key_scope "20190226/eu-west-2/s3/aws4_request";
aws_s3_bucket 'bucket_name';
location / {
aws_sign;
aws_access_key "AKI";
aws_signing_key "xyz";
aws_key_scope "20190226/eu-west-2/s3/aws4_request";
aws_endpoint "s3.eu-west-2.amazonaws.com";
proxy_pass http://bucket_name.s3.eu-west-2.amazonaws.com/;
resolver 8.8.8.8 valid=300s;
resolver_timeout 10s;
}
}
}
Config:
worker_processes 1;
events {
worker_connections 1024;
}
http {
server {
listen 80;
client_max_body_size 100G;
aws_access_key 'AKI';
aws_signing_key "xyz";
aws_key_scope "20190226/eu-west-2/s3/aws4_request";
aws_s3_bucket 'bucket_name';
location / {
aws_sign;
aws_access_key "AKI";
aws_signing_key "xyz";
aws_key_scope "20190226/eu-west-2/s3/aws4_request";
aws_endpoint "s3.eu-west-2.amazonaws.com";
proxy_pass http://bucket_name.s3.eu-west-2.amazonaws.com/;
resolver 8.8.8.8 valid=300s;
resolver_timeout 10s;
}
}
}