{"action":"created","issue":{"url":"https://api.github.com/repos/chef-cookbooks/aws/issues/209","repository_url":"https://api.github.com/repos/chef-cookbooks/aws","labels_url":"https://api.github.com/repos/chef-cookbooks/aws/issues/209/labels{/name}","comments_url":"https://api.github.com/repos/chef-cookbooks/aws/issues/209/comments","events_url":"https://api.github.com/repos/chef-cookbooks/aws/issues/209/events","html_url":"https://github.com/chef-cookbooks/aws/issues/209","id":131319774,"number":209,"title":"Net::HTTPServerException: 400 \"Bad Request\" on S3 download","user":{"login":"petewilcock","id":6526265,"avatar_url":"https://avatars.githubusercontent.com/u/6526265?v=3","gravatar_id":"","url":"https://api.github.com/users/petewilcock","html_url":"https://github.com/petewilcock","followers_url":"https://api.github.com/users/petewilcock/followers","following_url":"https://api.github.com/users/petewilcock/following{/other_user}","gists_url":"https://api.github.com/users/petewilcock/gists{/gist_id}","starred_url":"https://api.github.com/users/petewilcock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petewilcock/subscriptions","organizations_url":"https://api.github.com/users/petewilcock/orgs","repos_url":"https://api.github.com/users/petewilcock/repos","events_url":"https://api.github.com/users/petewilcock/events{/privacy}","received_events_url":"https://api.github.com/users/petewilcock/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-04T11:33:20Z","updated_at":"2016-02-04T14:43:03Z","closed_at":null,"body":"Trying to download a file from S3 and cannot find a cause for this error. The instance has a role with full permissions and I've also tried it using manually-specified ID and Key with the same result. \r\n\r\nI can use the aws-cli command to retrieve the file manually, so no problem with permissions. \r\n\r\nError executing action create on resource 'aws_s3_file[/var/www/website.com.tar.gz]\r\n    ================================================================================\r\n\r\n    Net::HTTPServerException\r\n    ------------------------\r\n    remote_file[/var/www/website.com.tar.gz] (/var/chef/cache/cookbooks/aws/providers/s3_file.rb line 37) had an error: Net::HTTPServerException: 400 \"Bad Request\"\r\n\r\n    Resource Declaration:\r\n    ---------------------\r\n    # In /var/chef/cache/cookbooks/wpnode/recipes/webserver.rb\r\n\r\n     33: aws_s3_file \"/var/www/website.com.tar.gz\" do\r\n     34:   bucket \"mybucket\"\r\n     35:   remote_path \"wordpress/website.com.tar.gz\"\r\n     36:   aws_access_key_id \"my id\"\r\n     37:   aws_secret_access_key \"my key\"\r\n     38:   region 'eu-west-1'\r\n     39: end\r\n\r\n    Compiled Resource:\r\n    ------------------\r\n    # Declared in /var/chef/cache/cookbooks/wpnode/recipes/webserver.rb:33:in `from_file'\r\n\r\n    aws_s3_file(\"/var/www/website.com.tar.gz\") do\r\n      action [:create]\r\n      retries 0\r\n      retry_delay 2\r\n      default_guard_interpreter :default\r\n      path \"/var/www/website.com.tar.gz\"\r\n      declared_type :aws_s3_file\r\n      cookbook_name \"wpnode\"\r\n      recipe_name \"webserver\"\r\n      bucket \"mybucket\"\r\n      remote_path \"wordpress/website.com.tar.gz\"\r\n      aws_access_key_id \"my id\"\r\n      aws_secret_access_key \"my key\"\r\n      use_etag true\r\n      use_last_modified true\r\n      atomic_update true\r\n    end\r\n\r\n\r\n`[2016-02-04T11:19:43+00:00] ERROR: aws_s3_file[/var/www/website.com.tar.gz] \r\n(wpnode::webserver line 33) had an error: Net::HTTPServerException: remote_file[/var/www/website.com.tar.gz] (/var/chef/cache/cookbooks/aws/providers/s3_file.rb line 37) had an error: Net::HTTPServerException: 400 \"Bad Request\"`\r\n\r\n`[2016-02-04T11:19:43+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)`"},"comment":{"url":"https://api.github.com/repos/chef-cookbooks/aws/issues/comments/179876367","html_url":"https://github.com/chef-cookbooks/aws/issues/209#issuecomment-179876367","issue_url":"https://api.github.com/repos/chef-cookbooks/aws/issues/209","id":179876367,"user":{"login":"petewilcock","id":6526265,"avatar_url":"https://avatars.githubusercontent.com/u/6526265?v=3","gravatar_id":"","url":"https://api.github.com/users/petewilcock","html_url":"https://github.com/petewilcock","followers_url":"https://api.github.com/users/petewilcock/followers","following_url":"https://api.github.com/users/petewilcock/following{/other_user}","gists_url":"https://api.github.com/users/petewilcock/gists{/gist_id}","starred_url":"https://api.github.com/users/petewilcock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petewilcock/subscriptions","organizations_url":"https://api.github.com/users/petewilcock/orgs","repos_url":"https://api.github.com/users/petewilcock/repos","events_url":"https://api.github.com/users/petewilcock/events{/privacy}","received_events_url":"https://api.github.com/users/petewilcock/received_events","type":"User","site_admin":false},"created_at":"2016-02-04T14:43:03Z","updated_at":"2016-02-04T14:43:03Z","body":"Update: In the debug I can see the full URL request for the file. If I put that into my browser before it expires I can see the following error:\r\n\r\n> <Error>\r\n<Code>AuthorizationQueryParametersError</Code>\r\n<Message>\r\nError parsing the X-Amz-Credential parameter; the region 'us-east-1' is wrong; expecting 'eu-west-1'\r\n</Message>\r\n<Region>eu-west-1</Region>\r\n<RequestId>FBB50AF6CE3A125C</RequestId>\r\n<HostId>\r\nP3XmHw5oBdgTrA0k/+o9onx8slgOqLrGVMJggjzK6JBP4bIFZvQiG3Z9xPSFPzx58xO9T0qq1g0=\r\n</HostId>\r\n</Error>\r\n\r\nDespite the region being set as 'eu-west-1', it seems to be nevertheless trying to use us-east-1, so the bug lies here?"}}