upload_to_S3: Upload a file to Amazon S3

View source: R/utils.R

upload_to_S3R Documentation

Upload a file to Amazon S3

Description

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

Usage

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

## 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)

Bioconductor/AnnotationHubData documentation built on Oct. 31, 2024, 8:13 a.m.