我正在尝试使用Net::Amazon::S3 Perl Module
我收到的错误如PermanentRedirect: The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint 301
响应。
我尝试的是
use Net::Amazon::S3;
use Data::Dumper;
my $aws_access_key_id = '*******';
my $aws_secret_access_key = '*******************';
my $bucketname = 'TESTBUCKET';
my $s3 = Net::Amazon::S3->new(
{ aws_access_key_id => $aws_access_key_id,
aws_secret_access_key => $aws_secret_access_key,
host=>'s3-website-us-west-1.amazonaws.com ',
retry => 1,
}
);
my $response = $s3->buckets;
foreach my $bucket ( @{ $response->{buckets} } ) {
print "You have a bucket: " . $bucket->bucket . "\n";
}
$bucket1 = $s3->bucket($bucketname);
$bucket1->add_key_filename( 'tmp.zip',"/Examples/Perl/tmp.zip",
{'x-amz-meta-file-mtime' => 'Thu Aug 6 15:09:00 IST 2015'}
) or die $s3->err . ": " . $s3->errstr;
我的终端是s3-website-us-west-1.amazonaws.com
我正在列出这些存储桶。
但无法上传。
任何帮助表示赞赏。
答案 0 :(得分:0)
上面的代码是正确的,只需要更改端点。 host=>'s3-website-us-west-1.amazonaws.com '
这是Bucket的终点。
我们需要给出区域端点host =>'s3-us-west-1.amazonaws.com'