server {
  ...
  location /static/ {
    proxy_set_header <bucket_name>.s3.ap-northeast-2.amazonaws.com;
    proxy_pass https://<bucket_name>.s3.ap-northeast-2.amazonaws.com/static/;
  }
}
this works well. but below code get 403(access denied error from aws)
server {
  set $bucket "<bucket_name>.s3.ap-northeast-2.amazonaws.com";
    location /static/ {
      proxy_set_header Host $bucket;
      proxy_pass https://$bucket/static/;
    }
}
Did I make mistake? I don't unserstand why $bucket variable not working well..