Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

400 Bad Request respond from non default region #19

Closed
tal5ab opened this issue Dec 20, 2016 · 7 comments
Closed

400 Bad Request respond from non default region #19

tal5ab opened this issue Dec 20, 2016 · 7 comments

Comments

@tal5ab
Copy link

tal5ab commented Dec 20, 2016

Hi
I am trying to download a file from few S3 buckets
Files from Location: US West (Oregon) (us-west-2) works fine (This is Amazone default region)
But when i try to get from Location: EU (Frankfurt) (eu-central-1) i get Amazon::S3: Amazon responded with 400 Bad Request

How do i tell this module my bucket is located in non default region?
There is no mention of this in the docs as far as i can see

my code

	my $s3 = Amazon::S3->new({
			aws_access_key_id     => $accessKey,
			aws_secret_access_key => $secret_access_key,
			retry                 => 1,
	});
		my $bucket = $s3->bucket($bucket_name);
		my $response = $bucket->get_key_filename($path_to_file,'GET',$destination_file) or die $s3->err . ": ". $s3->errstr;
@renatocron
Copy link

When you create a new S3 client object, use argument host:

* host *
   The S3 host endpoint to use. Defaults to 's3.amazonaws.com'. 
   This allows you to connect to any S3-compatible host.

Net::Amazon::S3->new( { host => 's3.ca-central-1.amazonaws.com' , aws_access_key_id...} )

@tal5ab
Copy link
Author

tal5ab commented Dec 20, 2016

Thank you for such a fast respond
But i tried all 3 possible EU URLs:
s3.eu-central-1.amazonaws.com
s3-eu-central-1.amazonaws.com
s3.dualstack.eu-central-1.amazonaws.com

	my $s3 = Amazon::S3->new({
			host				  => 's3.dualstack.eu-central-1.amazonaws.com',
			aws_access_key_id     => $accessKey,
			aws_secret_access_key => $secret_access_key,
			retry                 => 1,
	});

None of them worked
Still getting 400

@renatocron
Copy link

You are using Amazon::S3, not Net::Amazon::S3

I strongly recommend you to adapt your code to use Net::Amazon::S3 on version 0.80 (before this version, I can't recommend either!)

@tal5ab
Copy link
Author

tal5ab commented Dec 21, 2016

	my $s3 = Net::Amazon::S3->new({
			host				  => 's3-eu-central-1.amazonaws.com',
			aws_access_key_id     => $accessKey,
			aws_secret_access_key => $secret_access_key,
			retry                 => 1,
	});

C:\Users\cuser>cpan install Net::Amazon::S3
Loading internal null logger. Install Log::Log4perl for logging messages
CPAN: CPAN::SQLite loaded ok (v0.211)
Database was generated on Tue, 20 Dec 2016 07:41:59 GMT

CPAN: Module::CoreList loaded ok (v5.20160121)
Net::Amazon::S3 is up to date (0.80).

but still i get
Net::Amazon::S3: Amazon responded with 400 Bad Request
at C:/Strawberry/perl/site/lib/Net/Amazon/S3/Bucket.pm line 151.

@Bu11etmagnet
Copy link

Bu11etmagnet commented Dec 23, 2016 via email

@rustyconover
Copy link
Owner

The problem is the Frankfurt region uses AWS signatures version 4, I don't believe this module implements them, yet.

@ranguard
Copy link
Collaborator

https://metacpan.org/release/LLAP/Net-Amazon-S3-0.81-TRIAL just released with V4 support - any testing you can do would be appreciated - please do open issue if you have any

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants