-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathrstudio-s3-access.qmd
More file actions
34 lines (24 loc) · 913 Bytes
/
rstudio-s3-access.qmd
File metadata and controls
34 lines (24 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
---
title: RStudio VEDA S3 Bucket Access
subtitle: 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)
```