zapier / aws.s3 Goto Github PK
View Code? Open in Web Editor NEWThis project forked from cloudyr/aws.s3
Amazon Simple Storage Service (S3) API Client
This project forked from cloudyr/aws.s3
Amazon Simple Storage Service (S3) API Client
# AWS S3 Client Package # **aws.s3** is a simple client package for the Amazon Web Services (AWS) Simple Storage Service (S3) REST API. While [other packages](https://github.com/ropensci/webservices#amazon) currently connect R to S3, they do so incompletely (mapping only some of the API endpoints to R) and most implementations rely on the AWS command-line tools, which users may not have installed on their system. To use the package, you will need an AWS account and enter your credentials into R. Your keypair can be generated on the [IAM Management Console](https://console.aws.amazon.com/iam/home?#security_credential) under the heading *Access Keys*. Note that you only have access to your secret key once. After it is generated, you need to save it in a secure location. New keypairs can be generated at any time if yours has been lost, stolen, or forgotten. By default, all **cloudyr** packages look for the access key ID and secret access key in environment variables. You can also use this to specify a default region. For example: ```R Sys.setenv("AWS_ACCESS_KEY_ID" = "mykey", "AWS_SECRET_ACCESS_KEY" = "mysecretkey", "AWS_DEFAULT_REGION" = "us-east-1") ``` These can alternatively be set on the command line or via an `Renviron.site` or `.Renviron` file ([see here for instructions](http://cran.r-project.org/web/packages/httr/vignettes/api-packages.html)). ## Code Examples ## The package can be used to examine publicly accessible S3 buckets and publicly accessible S3 objects without registering an AWS account. If credentials have been generated in the AWS console and made available in R, you can find your available buckets using: ```R library("aws.s3") bucketlist() ``` If your credentials are incorrect, this function will return an error. Otherwise, it will return a list of information about the buckets you have access to. ### Buckets ### To get a listing of all objects in a public bucket, simply call ```R get_bucket(bucket = '1000genomes') ``` Amazon maintains a listing of [Public Data Sets](https://aws.amazon.com/datasets) on S3. To get a listing for all objects in a private bucket, pass your AWS key and secret in as parameters. (As described above, all functions in `aws.s3` will look for your keys as environment variables by default, greatly simplifying the process of making a s3 request.) ```R # specify keys in-line get_bucket( bucket = 'my_bucket', key = YOUR_AWS_ACCESS_KEY, secret = YOUR_AWS_SECRET_ACCESS_KEY ) # specify keys as environment variables Sys.setenv("AWS_ACCESS_KEY_ID" = "mykey", "AWS_SECRET_ACCESS_KEY" = "mysecretkey") get_bucket("my_bucket") ``` ### Objects ### There are six main functions that will be useful for working with objects in S3: 1. `get_object()` returns a raw vector representation of an S3 object. 2. `save_object()` saves an S3 object to a specified local file. 3. `put_object()` stores a local file into an S3 bucket. 4. `s3save()` saves one or more in-memory R objects to an .Rdata file in S3 (analogously to `save()`). `s3saveRDS()` is an analogue for `saveRDS()`. 5. `s3load()` loads one or more objects into memory from an .Rdata file stored in S3 (analogously to `load()`). `s3readRDS()` is an analogue for `saveRDS()`. 6. `s3source()` sources an R script directly from S3. They behave as you would probably expect: ```R # save an in-memory R object into S3 s3save(mtcars, bucket = "my_bucket", object = "mtcars.Rdata") # `load()` R objects from the file s3load("mtcars.Rdata", bucket = "my_bucket") # get file as raw vector get_object("mtcars.Rdata", bucket = "my_bucket") # save file locally save_object("mtcars.Rdata", file = "mtcars.Rdata", bucket = "my_bucket") # put local file into S3 put_object(file = "mtcars.Rdata", object = "mtcars2.Rdata", bucket = "my_bucket") ``` ## Installation ## [![CRAN](http://www.r-pkg.org/badges/version/aws.s3)](http://cran.r-project.org/package=aws.s3) [![Build Status](https://travis-ci.org/cloudyr/aws.s3.png?branch=master)](https://travis-ci.org/cloudyr/aws.s3) [![codecov.io](http://codecov.io/github/cloudyr/aws.s3/coverage.svg?branch=master)](http://codecov.io/github/cloudyr/aws.s3?branch=master) This package is not yet on CRAN. To install the latest development version you can install from the cloudyr drat repository: ```R # latest stable version install.packages("aws.s3", repos = c(getOption("repos"), "http://cloudyr.github.io/drat")) ``` Or, to pull a potentially unstable version directly from GitHub: ```R if(!require("ghit")){ install.packages("ghit") } ghit::install_github("cloudyr/aws.s3") ``` --- [![cloudyr project logo](http://i.imgur.com/JHS98Y7.png)](https://github.com/cloudyr)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.