1

I'm using awscli (S3 Api) to operate some requests with my softlayer objectstorage. I can retrieve the buckets list, create or delete bucket. When i try to copy a sample file to a specific bucket, i'm getting an error : aws --endpoint-url=https://s3-api.us-geo.objectstorage.softlayer.net s3 cp test.txt s3://my_test_bucket/files

I'm getting the following error (tested with both sdk apis, python boto3 api and wascli)

upload failed: ./test.txt to s3://my_test_bucket/test.txt An error occurred (SignatureDoesNotMatch) when calling the PutObject operation: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. For more information, see REST Authentication and SOAP Authentication for details.

2 Answers2

1

That's odd - you appear to be using the correct syntax. How are you passing your credentials? The easiest way would be in a ~/.aws/credentials file that contains:

[default]
aws_access_key_id = {Access Key ID}
aws_secret_access_key = {Secret Access Key}

If you are getting the same error across different tools/libraries this is likely the issue. If you have your credentials set up correctly and are still getting the signature issue we'll need to probably do a deeper dive to figure out what's going on, because it appears you aren't doing anything incorrect.

Nick Lange
  • 857
  • 6
  • 8
  • I use the `aws configure` command and with evn variables (Using `SET VALUE=KEY`) , i'm able to list all content of my bucket but can't upload – Houssem Fathallah Jan 13 '17 at 17:13
  • Ok, looks like you may have found a defect! Try going into `~/.aws/config` and deleting anything that specifies a region, then try running a command again. – Nick Lange Jan 13 '17 at 17:29
  • 1
    I tested it but no solution,, I'm using a windows os, i will see if it's related to os because it works fine for a ubuntu os. thank you any way. – Houssem Fathallah Jan 13 '17 at 17:36
  • If you can't get it sorted out, feel free to send me an email at `nicholas.lange[at]ibm.com` and we can try and figure it out. If it's a defect I'd like to get it fixed, and if it's a OS issue I'd like to have it documented. – Nick Lange Jan 13 '17 at 18:29
  • Thank you @nick, initially i used windows then i used a docker ubuntu image based image I can list the buckets and their contents but can't upload. Now i redo every thing on a ubuntu os 14.04, and python 2.7.6 . None of this works with either aswcli (the python based cli) nor by code. So i switched to test it with a ruby code and the **ruby aws-sdk** and every thing works fine (upload/download). Now I'm pretty sure that is related to the python version provided by aws or in boto. – Houssem Fathallah Jan 14 '17 at 09:42
0

The reason why you got the error may be the signature version is different.
IBM Cloud Object Storage using signature version 2 but the default version is 4. http://docs.aws.amazon.com/general/latest/gr/signature-version-2.html

I'm not sure how to set the signature version by curl and python.
In SDK for Java, you need to set like this, otherwise you got the error.

AWSCredentialsProvider provider = loadCredentialProvider();

ClientConfiguration config = new ClientConfiguration();
config.withSignerOverride("S3SignerType");

// second arg region not needed
EndpointConfiguration endpointConfiguration = 
        new EndpointConfiguration(us-geo.objectstorage.softlayer.net, "");

AmazonS3 cos = AmazonS3ClientBuilder.standard()
        .withCredentials(provider)
        .withClientConfiguration(config)
        .withEndpointConfiguration(endpointConfiguration)
        .build();