cloudyr / aws.s3

Amazon Simple Storage Service (S3) API Client
https://cloud.r-project.org/package=aws.s3
381 stars 148 forks source link

Retrieving a csv file in S3 - #244

Open BrianMiner opened 6 years ago

BrianMiner commented 6 years ago

I am able to access my buckets as

library("aws.s3")
bucketlist()

I have a csv file in a bucket nested in folders. When I try to read in the csv:

read.csv(text = rawToChar(get_object(object = "/folder/folder2/filename.csv", bucket="mybucket")))

I received an error (is there a more proper way to access the file)?

X..xml.version.1.0.encoding.UTF.8..
1 <Error><Code>PermanentRedirect</Code><Message>The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.</Message><Bucket>mybucket</Bucket><Endpoint>mybucket.s3.amazonaws.com</Endpoint><RequestId>8DD0D95EA0113249</RequestId><HostId>rsU23k2Q4lTEUqLDL+074wwZdlCVHOPnec6aip5sGUmCHax2ety9don+3SAR8JWWa1rvSFYK+hk=</HostId></Error>
leeper commented 6 years ago

Try adding url_style ="virtual" to your call.

arpit1195 commented 6 years ago

image