cloudyr / aws.s3

Amazon Simple Storage Service (S3) API Client
https://cloud.r-project.org/package=aws.s3
381 stars 148 forks source link

put-public-access-block s3api endpoint exposed? #405

Open FMKerckhof opened 2 years ago

FMKerckhof commented 2 years ago

Please specify whether your issue is about:


Dear, I was wondering if the s3api endpoint put-public-access-block is/could be exposed through the aws.s3 package? I am aware of the existence of the put_bucket_policy and put_acl functions - but it would be quite convenient if - upon creating a new bucket - all objects and the bucket itself could be set to not public using the simple configuration options of public-access-block-configuration (see https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3api/put-public-access-block.html) .


## load package
library("aws.s3")

## code goes here
putbucket_result <- put_bucket("bucketname")
# unclear how to set this bucket (and objects) to non-public using put-public-access block

## session info for your system
sessionInfo()
# R version 4.1.1 (2021-08-10)
# Platform: x86_64-w64-mingw32/x64 (64-bit)
# Running under: Windows 10 x64 (build 19043)
# 
# Matrix products: default
# 
# locale:
# [1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252   
# [3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C                           
# [5] LC_TIME=English_United Kingdom.1252    
# 
# attached base packages:
# [1] stats     graphics  grDevices utils     datasets  methods   base     
# 
# other attached packages:
# [1] aws.s3_0.3.21
# 
# loaded via a namespace (and not attached):
#  [1] digest_0.6.28       aws.signature_0.6.0 R6_2.5.1            jsonlite_1.7.2      evaluate_0.14      
#  [6] httr_1.4.2          rlang_0.4.12        curl_4.3.2          xml2_1.3.2          rmarkdown_2.11     
# [11] tools_4.1.1         rsconnect_0.8.24    xfun_0.27           yaml_2.2.1          fastmap_1.1.0      
# [16] compiler_4.1.1      base64enc_0.1-3     htmltools_0.5.2     knitr_1.36 

My default way of setting this using AWS CLI (v2) would be:

aws --profile default s3api put-public-access-block \
    --bucket bucketname \
    --public-access-block-configuration "BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true"
UCDNJJ commented 2 years ago

I just wanted to second this recommendation.