synGetStsStorageToken | R Documentation |
Get STS credentials for the given entity_id and permission, outputting it in the given format
synGetStsStorageToken(entity, permission, output_format=json, min_remaining_life=NULL)
entity |
the entity or entity id whose credentials are being returned |
permission |
one of 'read_only' or 'read_write' |
output_format |
one of 'json', 'boto', 'shell', 'bash', 'cmd', 'powershell' |
min_remaining_life |
the minimum allowable remaining life on a cached token to return. if a cached token |
## Not run:
library("aws.s3")
# create a storage location
folder_and_storage_location <- synCreateS3StorageLocation(parent='syn123', folder_name='test_folder', bucket_name='aws-bucket-name', base_key='test', sts_enabled=TRUE)
folder <- folder_and_storage_location[[1]]
storage_location <- folder_and_storage_location[[2]]
# get a write permission token
sts_write_token <- synGetStsStorageToken(entity=folder$properties$id, permission='read_write')
# configure the environment with AWS token
Sys.setenv('AWS_ACCESS_KEY_ID'=sts_write_token$accessKeyId, 'AWS_SECRET_ACCESS_KEY'=sts_write_token$secretAccessKey, 'AWS_SESSION_TOKEN'=sts_write_token$sessionToken)
# upload the file directly to s3
put_object(file='/tmp/foo.txt', object='test/foo.txt', bucket='aws-bucket-name')
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.