0

Even though actual use case is to store the data within shiny session, I have simplified to be clear on the goal.

Could you please help me understand what changes I need to make in order to save the Csv/xlsx into S3 bucket ?

Relevant but python save a csv file into s3 bucket from pypark dataframe

library(tidyverse)
library(aws.s3)

# Authetication
aws.signature::use_credentials()
s3_bucket_link = # My s3 bucket link

  df = fread("mtcars.csv")

  #put object to s3
  aws.s3::put_object(object = "mtcars.csv",
                     file = "mtcars.csv",
                     bucket = s3_bucket_link)
  # Gives 403 or 404 error 
  # But when I check my S3 bucket file isnt available !!!
Abhishek
  • 407
  • 3
  • 18

1 Answers1

0
library(tidyverse)
library(aws.s3)

# Authetication
aws.signature::use_credentials()
s3_bucket_link = # s3 bucket link
complete_path = # Complete S3 bucket path including folder within S3 bucket link

write.csv(mtcars,"mtcars.csv")

aws.s3::s3write_using(mtcars,
                      object = paste0(complete_path,"mtcars.csv"),
                      FUN = write.csv,
                      bucket = s3_bucket_link)
Abhishek
  • 407
  • 3
  • 18