upload_to_S3: Upload a file to Amazon S3

Description Usage Arguments Details Value Author(s) Examples

View source: R/utils.R

Description

This function is for uploading a file resource to the S3 cloud.

Usage

1
upload_to_S3(file, remotename, bucket, profile, acl="public-read")

Arguments

file

The file to upload.

remotename

The name this file should have in S3, including any "keys" that are part of the name. This should not start with a slash (if it does, the leading slash will be removed), but can contain forward slashes.

bucket

Name of the S3 bucket to copy to.

profile

Corresponds to a profile set in the config file for the AWS CLI (see the documentation). If this argument is omitted,the default profile is used.

acl

Should be one of private, public-read, or public-read-write.

Details

Uses the AWS Command Line Interface to copy a file to Amazon S3. Assumes the CLI is properly configured and that the aws program is in your PATH. The CLI should be configured with the credentials of a user who has permission to upload to the appropriate bucket. It's recommended to use IAM to set up users with limited permissions.

There is an RAmazonS3 package but it seems to have issues uploading files to S3.

Value

TRUE on success. If the command fails, the function will exit with an error.

Author(s)

Dan Tenenbaum

Examples

1
2
3
4
5
6
## Not run: 
upload_to_S3("myfile.txt", "foo/bar/baz/yourfile.txt")
# If this is successful, the file should be accessible at 
# http://s3.amazonaws.com/annotationhub/foo/bar/baz/yourfile.txt

## End(Not run)

AnnotationHubData documentation built on April 17, 2021, 6:05 p.m.