0

I am using the sample from https://github.com/rbrigham/s3-signed-url to generate the S3 presigned url. When i access the generated url I get below error:

 <Error>
<Code>AccessDenied</Code>
<Message>
Query-string authentication requires the Signature, Expires and AWSAccessKeyId parameters
</Message>
<RequestId>60F1F4F2EC1B24BB</RequestId>
<HostId>
dhHvqSpTqXn1e01TKXAKV8+pzPZkNKGcuCYEuyYMvViRvLdbxpe2ml9Po66t+tboRMPhClmYQe8=
</HostId>
</Error>

Can anybody tell me what else I am missing?

I have bucket name containing the dot characters and have to use SSL certificate so I need PATH based s3 url.

Do I need to set any specific permission on my IAM user/s3 bucket? I have all permission on S3(I have aws full admin access iam policy set).

Ex url:

https://s3-eu-west-1.amazonaws.com/<bucket_name>/<object>?Signature=xxxxxxxxxxxxxxxxxxxx&AWSAccessKeyId=xxxxxxxxxxxxxxxxxxx&Expires=1000000%
ExploringApple
  • 1,348
  • 2
  • 17
  • 30
  • It's difficult to tell if you made the error when sanitizing the signed URL, but there is a missing `&` before `AWSAccessKeyId` that would explain this error. – Michael - sqlbot Mar 01 '17 at 18:50
  • @Michael Thanks for comment, the & was just typo here. I am able to solve this issue with this(https://github.com/gdbtek/aws-tools) bash script. Looks like there was issue with perl api I was using. – ExploringApple Mar 02 '17 at 09:05

1 Answers1

0

To achieve this within Perl, use Amazon::S3::SignedURLGenerator

use Amazon::S3::SignedURLGenerator;

my $generator = Amazon::S3::SignedURLGenerator->new(
    aws_access_key_id     => $aws_access_key_id,
    aws_secret_access_key => $aws_secret_access_key,
    prefix => 'https://mybucket.s3.amazonaws.com',
    expires => 600, # 10 minutes
);

my $url = $generator->generate_url('GET', 'path/file.txt', {});
Steve E.
  • 9,003
  • 6
  • 39
  • 57