Sunday 16 February 2020

Accessing S3 from R in EC2 instance


Example of reading data in R (in EC2) from S3
> install.packages("RCurl")
> library("RCurl")
> data <- a="" class="external-link" geturl="" href="https://s3.amazonaws.com/cellbio-pringles-xtra-snapshot/resultsaffy.csv" read.table="" rel="nofollow" style="color: #3572b0; text-decoration-line: none;" textconnection="">https://s3.amazonaws.com/cellbio-pringles-xtra-snapshot/resultsaffy.csv
")), sep=",", header=FALSE)
> head(data) 
put_object("trees.csv", bucket = pringle-extra-cell-files)
sessionInfo()
library("aws.s3")
bucketlist()
get_bucket(bucket = 'pringle-extra-cell-files')
get_object("outputresultsaffy.csv", bucket = 'pringle-extra-cell-filest')
delete_bucket("narendra1521538971319")
put_object("trees.csv", bucket = pringle-extra-cell-files)
library("aws.s3")
put_object("trees.csv", bucket ="pringle-extra-cell-files")
q()
put_object("trees.csv", bucket ="pringle-extra-cell-files")
library("aws.s3")
put_object("trees.csv", bucket ="pringle-extra-cell-files")
get_object("outputresultsaffy.csv", bucket = "pringle-extra-cell-files")




[1] TRUE is coming from S# saying it is stored in s3 now. (smile)