How to save csv or xlsx into S3 bucket ?

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 ?

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 !!!
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
  df = fread("mtcars.csv")

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

aws.s3::s3write_using(mtcars,
                      object = paste0(complete_path,"mtcars.csv"),
                      FUN = write.csv,
                      bucket = s3_bucket_link)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.