RStudio VEDA S3 Bucket Access

Setting environment variables to access VEDA S3 buckets in RStudio

Overview

Users of the RStudio image in the VEDA Jupyterhub cannot access VEDA AWS buckets the same way Python Pangeo users can. This is because RStudio does not read global system environmental variables, which is where VEDA’s AWS credentials are set. In this example, we will:

  1. Set environment variables

  2. Access data in a VEDA S3 bucket

Set Environment Variables

Sys.setenv(AWS_ROLE_ARN="arn:aws:iam::444055461661:role/nasa-veda-prod")
Sys.setenv(AWS_WEB_IDENTITY_TOKEN_FILE="/var/run/secrets/eks.amazonaws.com/serviceaccount/token")

Access Data in a VEDA S3 Bucket

Load package(s)

library(terra)

Open the data

vsi_path <- '/vsis3/veda-data-store/landslides-nc-flood/NC_Flood_Extent_2024-09-29.tif'
nc_flood <- rast(vsi_path)
print(nc_flood)