Trouble deleting a bucket from another region
Closed this issue · 2 comments
wlandau commented
I am not sure if this is a configuration error on my end, but I am having trouble deleting a bucket I created in a non-default region. Interestingly, this only happens in my company's AWS account, not my personal one. I am using the CRAN versions of paws
(0.3.0), paws.common
(0.5.9), and paws.storage
(0.3.0).
random_bucket_name <- function() {
paste0(
"targets-test-bucket-",
substr(
digest::digest(tempfile(), algo = "sha256"),
start = 0,
stop = 43
)
)
}
bucket <- random_bucket_name()
region <- "us-west-2"
client <- paws.storage::s3(config = list(region = region))
client$create_bucket(
Bucket = bucket,
CreateBucketConfiguration = list(LocationConstraint = region)
)
client$delete_bucket(Bucket = bucket)
#> Error: AccessDenied (HTTP 403). Access Denied
traceback()
#> 6: stop(error)
#> 5: handler$fn(request)
#> 4: run(request, retry)
#> 3: retry(request)
#> 2: send_request(request)
#> 1: client$delete_bucket(Bucket = bucket)
sessionInfo()
#> R version 4.3.0 (2023-04-21)
#> Platform: aarch64-apple-darwin20 (64-bit)
#> Running under: macOS Ventura 13.5
#>
#> Matrix products: default
#> BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0
#>
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#>
#> time zone: America/Indiana/Indianapolis
#> tzcode source: internal
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] targets_1.2.2.9001 testthat_3.1.8
#>
#> loaded via a namespace (and not attached):
#> [1] utf8_1.2.3 xml2_1.3.4 stringi_1.7.12 paws.common_0.5.9
#> [5] digest_0.6.33 magrittr_2.0.3 pkgload_1.3.2 fastmap_1.1.1
#> [9] rprojroot_2.0.3 processx_3.8.2 pkgbuild_1.4.1 sessioninfo_1.2.2
#> [13] brio_1.1.3 backports_1.4.1 urlchecker_1.0.1 ps_1.7.5
#> [17] promises_1.2.0.1 httr_1.4.6 fansi_1.0.4 purrr_1.0.2
#> [21] codetools_0.2-19 cli_3.6.1 shiny_1.7.4 rlang_1.1.1
#> [25] crayon_1.5.2 ellipsis_0.3.2 yaml_2.3.7 remotes_2.4.2
#> [29] withr_2.5.0 cachem_1.0.8 devtools_2.4.5 tools_4.3.0
#> [33] memoise_2.0.1 base64url_1.4 httpuv_1.6.11 curl_5.0.1
#> [37] vctrs_0.6.3 R6_2.5.1 mime_0.12 lifecycle_1.0.3
#> [41] stringr_1.5.0 fs_1.6.2 htmlwidgets_1.6.2 usethis_2.2.1
#> [45] miniUI_0.1.1.1 pkgconfig_2.0.3 desc_1.4.2 callr_3.7.3
#> [49] pillar_1.9.0 later_1.3.1 glue_1.6.2 data.table_1.14.8
#> [53] profvis_0.3.8 Rcpp_1.0.10 tidyselect_1.2.0 xfun_0.39
#> [57] tibble_3.2.1 paws.storage_0.3.0 rstudioapi_0.14 knitr_1.42
#> [61] xtable_1.8-4 htmltools_0.5.5 igraph_1.4.2 compiler_4.3.0
#> [65] prettyunits_1.1.1 #>
DyfanJones commented
My initial guess is that you don't have permission to do that based on your iam role. Do you know if there is an restrictions on your company role?
wlandau commented
Yeah, that turned out to be right. All I need is a non-default region so I can test alternative settings/configurations in targets
. I rewrote my tests to use us-east-1
or us-east-2
, whichever is not AWS_REGION
.