Skip to content

Instantly share code, notes, and snippets.

@lizturp
Created July 24, 2017 20:55
Show Gist options
  • Save lizturp/44ae1f0cd1e1d381f6310664df2bf611 to your computer and use it in GitHub Desktop.
Save lizturp/44ae1f0cd1e1d381f6310664df2bf611 to your computer and use it in GitHub Desktop.
Basic script to test upload to s3 functionality is working in R
#!/usr/bin/Rscript
library(aws.s3)
library(stringi)
source("./credentials/aws.txt")
#bucketlist()
s3conn <- rawConnection(raw(0), "r+")
#this is not writing anything out....
tempfile <- paste0("hello this is a test.")
put_object(tempfile,
object = ("liz-example/redshift/tempfile"),
bucket="my-bucket-name",
file=rawConnectionValue(s3conn),
headers = c('x-amz-server-side-encryption'='AES256'))
#but the file is there!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment