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

Aws::AwsError: SignatureDoesNotMatch #171

Open
krzkrzkrz opened this issue Jul 2, 2013 · 1 comment
Open

Aws::AwsError: SignatureDoesNotMatch #171

krzkrzkrz opened this issue Jul 2, 2013 · 1 comment

Comments

@krzkrzkrz
Copy link

I am trying to copy all contents in bucket b1 to bucket b2.

S3ID = 'id_here'
S3KEY = 'key_here'
SRCBUCKET = 'b1'
DESTBUCKET = 'b2'

bucket_logger ||= Logger.new("#{Rails.root}/log/bucket.log")
bucket_logger.info "Time started #{Time.now}"

s3 = RightAws::S3Interface.new(S3ID, S3KEY)
s3.incrementally_list_bucket(SRCBUCKET) do |h|
  h[:contents].each do |o|
    bucket_logger.info "Copying #{o[:key]}"
    # s3.copy(SRCBUCKET, o[:key], DESTBUCKET, o[:key])
  end
end

bucket_logger.info "Time ended #{Time.now}"

It starts copying some of the files. I can verify the output in the log file and the files in the bucket. And then it hits this error:

Opening new HTTPS connection to b1.s3.amazonaws.com:443
Closing HTTPS connection to b1.s3.amazonaws.com:443
Opening new HTTPS connection to b1.s3.amazonaws.com:443
##### Aws::S3Interface returned an error: 403 Forbidden
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message><StringToSignBytes>47 45 54 0a 0a 0a 54 75 65 2c 20 30 32 20 4a 75 6c 20 32 30 31 33 20 31 30 3a 33 35 3a 32 34 20 47 4d 54 0a 2f 74 77 69 74 6d 75 73 69 63 73 74 61 67 69 6e 67 2f</StringToSignBytes><RequestId>4B4D7951B3DC32D1</RequestId><HostId>oCZMLVNwCQh689ShjOWgJqVg5OnUOrogzGDQ5jPY6Z5vrzmrcyfJkofZ5ppfGUin</HostId><SignatureProvided>/jsAfXRbb0ZOslgbB8XnIOllzns=</SignatureProvided><StringToSign>GET


Tue, 02 Jul 2013 10:35:24 GMT
/b1/</StringToSign><AWSAccessKeyId>actual key here</AWSAccessKeyId></Error> #####
##### Aws::S3Interface request: b1.s3.amazonaws.com:443/?marker=assets%2Fglyphicons%2Fstandard%2Fglyphicons_262_spade%402x-996bbd6e7303a36b5f0a33174a982648.png ####
Closing HTTPS connection to b1.s3.amazonaws.com:443
Aws::AwsError: SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided. Check your key and signing method.
REQUEST=b1.s3.amazonaws.com:443/?marker=assets%2Fglyphicons%2Fstandard%2Fglyphicons_262_spade%402x-996bbd6e7303a36b5f0a33174a982648.png 
  from /Users/Chris/.rvm/gems/ruby-1.9.3-p392/bundler/gems/aws-f136acf02221/lib/awsbase/awsbase.rb:572:in `request_info_impl'
  from /Users/Chris/.rvm/gems/ruby-1.9.3-p392/bundler/gems/aws-f136acf02221/lib/awsbase/awsbase.rb:316:in `request_info2'
  from /Users/Chris/.rvm/gems/ruby-1.9.3-p392/bundler/gems/aws-f136acf02221/lib/awsbase/awsbase.rb:338:in `request_info3'
  from /Users/Chris/.rvm/gems/ruby-1.9.3-p392/bundler/gems/aws-f136acf02221/lib/s3/s3_interface.rb:186:in `request_info'
  from /Users/Chris/.rvm/gems/ruby-1.9.3-p392/bundler/gems/aws-f136acf02221/lib/s3/s3_interface.rb:349:in `incrementally_list_bucket'
  from (irb):30
  from /Users/Chris/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.11/lib/rails/commands/console.rb:47:in `start'
  from /Users/Chris/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.11/lib/rails/commands/console.rb:8:in `start'
  from /Users/Chris/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.11/lib/rails/commands.rb:41:in `<top (required)>'
  from script/rails:6:in `require'
  from script/rails:6:in `<main>'
@krzkrzkrz
Copy link
Author

It seems, after it fetches the first batch of 1000 keys, it doesn't apply the same amazon key and id

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

1 participant