Hoping to set up an R-script for collaborators upload their data to a Wasabi bucket. I have verified my access key and can access the bucket through Wasabi Explorer. But I am getting an error message when attempting the same using aws.s3 library for R.
Has anyone tried and succeeded with this? My sense is despite specifying end_url as ... wasabisys.com it still goes to ...amazonaws.com (see error message).
Any suggestions appreciated!
This is my test script
Load required package
library(aws.s3)
source("../../wasabi_credentials.R")
Set credentials
Sys.setenv("AWS_ACCESS_KEY_ID" = your_access_key_id,
"AWS_SECRET_ACCESS_KEY" = your_secret_access_key)
Specify bucket and region
bucket <- "salurbal-cec"
region <- "us-west-1" # Change to your Wasabi region (should match where the bucket is located and DO NOT prefix with 'wasabi')
#endpoint_url <- "https://s3.us-west-1.wasabisys.com" # Replace with the Wasabi endpoint URL for the bucket
Attempt to list objects in the bucket
objects <- get_bucket(bucket = bucket, region = region, endpoint_url = endpoint_url)
Check result
print(objects)
This is the error message (access code omitted)
List of 5
$ Code : chr "InvalidAccessKeyId"
$ Message : chr "The AWS Access Key Id you provided does not exist in our records."
$ AWSAccessKeyId: chr "****"
$ RequestId : chr "1BWGZ8Z9PM3YE4JA"
$ HostId : chr "dPRd/s5u4RCt9Esnh8VP9MhoADNKRY6sNce9HJ0/aw/3l4B+vh75A2XaO99/Gh9cf72exZSiErQ="
- attr(*, "headers")=List of 6
..$ x-amz-request-id : chr "1BWGZ8Z9PM3YE4JA"
..$ x-amz-id-2 : chr "dPRd/s5u4RCt9Esnh8VP9MhoADNKRY6sNce9HJ0/aw/3l4B+vh75A2XaO99/Gh9cf72exZSiErQ="
..$ content-type : chr "application/xml"
..$ transfer-encoding: chr "chunked"
..$ date : chr "Fri, 08 Mar 2024 22:56:51 GMT"
..$ server : chr "AmazonS3"
..- attr(*, "class")= chr [1:2] "insensitive" "list"
- attr(*, "class")= chr "aws_error"
- attr(*, "request_canonical")= chr "GET\n/salurbal-cec/\n\nhost:s3-us-west-1.amazonaws.com\nx-amz-date:20240308T225651Z\n\nhost;x-amz-date\ne3b0c44"| __truncated__
- attr(*, "request_string_to_sign")= chr "AWS4-HMAC-SHA256\n20240308T225651Z\n20240308/us-west-1/s3/aws4_request\neb7348922a3d5a7029c8db36aeade2fb08a46cc"| __truncated__
- attr(*, "request_signature")= chr "AWS4-HMAC-SHA256 Credential=****/20240308/us-west-1/s3/aws4_request,SignedHeaders=host;x-amz-da"| __truncated__
NULL
Error in parse_aws_s3_response(r, Sig, verbose = verbose) :
Forbidden (HTTP 403).