S3 AWS - generating presigned url in R

272 views Asked by At

I would like to do this in R using the package 'paws':

import boto3
    url = boto3.client('s3').generate_presigned_url(
    ClientMethod='get_object', 
    Params={'Bucket': 'BUCKET_NAME', 'Key': 'OBJECT_KEY'},
    ExpiresIn=3600)

from: https://docs.aws.amazon.com/AmazonS3/latest/userguide/ShareObjectPreSignedURL.html

Anyone has any idea how to do it? thanks!!

1

There are 1 answers

0
Dyfan Jones On

In the latest version of paws 0.2.0 this functionality has been added. Currently at time of this reply paws 0.2.0 hasn't been released to the cran. However you can install it from r-universe using the following command:

# Enable repository from paws-r
options(repos = c(
  pawsr = 'https://paws-r.r-universe.dev',
  CRAN = 'https://cloud.r-project.org'))
# Download and install paws in R
install.packages('paws')
paws::s3()$generate_presigned_url(
  client_method='get_object', 
  params=list(Bucket='BUCKET_NAME', Key='OBJECT_KEY'),
  expires_in=3600
)

I hope this helps :)