Ajees Basha
Ajees Basha

Reputation: 23

Unable to read csv file present in S3 from Sagemaker R studio

i am trying to read a csv file which is present in AWS s3 from Sagemaker R studio. I tried the below code.

library(reticulate)
library(readr)
library(dplyr)
boto3 <- import("boto3")
s3 <- boto3$client('s3')
d <- s3$download_file(Bucket=bucket_name, Key=path, Filename="file_name.csv")

i receive ClientError: An error occured (404) when calling the head object operation. Could some one please help

Upvotes: -1

Views: 345

Answers (1)

jarmod
jarmod

Reputation: 78653

HTTP 404 means Not Found. This happens when the object with the indicated key does not actually exist in the indicated S3 bucket. Check that you are using the correct bucket name and key name.

Note that the boto3 download_file function does not return a value (which I presume maps to NULL in R). The function saves the downloaded file to the filename you passed in when making the call, file_name.csv in your example. So, you will need to open and read the downloaded CSV file.

Upvotes: 2

Related Questions