Skip to content

Commit

Permalink
Merge pull request 2i2c-org#3431 from yuvipanda/req-pay
Browse files Browse the repository at this point in the history
Clarify what the requestor_pays flag does
  • Loading branch information
GeorgianaElena authored Feb 28, 2024
2 parents 32320d8 + c544d97 commit 31796fa
Show file tree
Hide file tree
Showing 27 changed files with 82 additions and 70 deletions.
34 changes: 28 additions & 6 deletions docs/howto/features/cloud-access.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,50 @@ This AWS IAM Role is managed via terraform.
## Enabling specific cloud access permissions

1. In the `.tfvars` file for the project in which this hub is based off
create (or modify) the `hub_cloud_permissions` variable. The config is
like:
create (or modify) the `hub_cloud_permissions` variable.

```{warning}
`allow_access_to_external_requester_pays_buckets` is not yet supported on AWS!
```

The config is like:

`````{tab-set}
````{tab-item} GCP
:sync: gcp-key
```yaml
hub_cloud_permissions = {
"<hub-name-slug>": {
allow_access_to_external_requester_pays_buckets : true,
bucket_admin_access : ["bucket-1", "bucket-2"]
hub_namespace : "<hub-name>"
}
}
```
````
````{tab-item} AWS
:sync: aws-key
```bash
hub_cloud_permissions = {
"<hub-name-slug>": {
requestor_pays : true,
bucket_admin_access : ["bucket-1", "bucket-2"]
hub_namespace : "<hub-name>"
}
}
```
````
`````

where:

1. `<hub-name-slug>` is the name of the hub, but restricted in length. This
and the cluster name together can't be more than 29 characters. `terraform`
will complain if you go over this limit, so in general just use the name
of the hub and shorten it only if `terraform` complains.
2. (GCP only) `requestor_pays` enables permissions for user pods and dask worker
pods to identify as the project while making requests to Google Cloud Storage
buckets marked as 'requestor pays'. More details [here](topic:features:cloud:gcp:requestor-pays).
2. (GCP only) `allow_access_to_external_requester_pays_buckets` enables permissions for user pods and dask worker
pods to identify as the project while making requests to other Google Cloud Storage
buckets, outside of this project, that have 'Requester Pays' enabled. More details [here](topic:features:cloud:gcp:requester-pays).
3. `bucket_admin_access` lists bucket names (as specified in `user_buckets`
terraform variable) all users on this hub should have full read/write
access to. Used along with the [user_buckets](howto:features:storage-buckets)
Expand Down
26 changes: 23 additions & 3 deletions docs/topic/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ improving the security posture of our hubs.

### GCP

(topic:features:cloud:gcp:requestor-pays)=
#### 'Requestor Pays' access to Google Cloud Storage buckets
(topic:features:cloud:gcp:requester-pays)=
#### 'Requester Pays' access

By default, the organization *hosting* data on Google Cloud pays for both
storage and bandwidth costs of the data. However, Google Cloud also offers
Expand All @@ -33,9 +33,29 @@ option, where the bandwidth costs are paid for by the organization *requesting*
the data. This is very commonly used by organizations that provide big datasets
on Google Cloud storage, to sustainably share costs of maintaining the data.

**Requester Pays** is a feature that a bucket can have.

#### Allow access to external `Requester Payes` buckets

If buckets outside the project have the `Requester Payes` flag, then we need to:
- set `hub_cloud_permissions.allow_access_to_external_requester_pays_buckets`
in the terraform config of the cluster (see the guide at [](howto:features:cloud-access:access-perms))
- this will allow them to be charged on their project for access of such
outside buckets

```{warning}
When this feature is enabled, users on a hub accessing cloud buckets from
other organizations marked as 'requestor pays' will increase our cloud bill.
other organizations marked as `Requester Pays` will increase our cloud bill.
Hence, this is an opt-in feature.
```

#### Enable `Requester Pays` flag on community buckets

The buckets that we set for communities, inside their projects can also have this flag enabled on them, which means that other people outside will be charged for their usage.

```{warning}
This is not supported yet by our terraform. Follow https://github.com/2i2c-org/infrastructure/issues/3746 to check when support will be added.
```

(topic:features:cloud:scratch-buckets)=
## 'Scratch' buckets on object storage
Expand Down
6 changes: 0 additions & 6 deletions terraform/aws/projects/2i2c-aws-us.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -31,35 +31,29 @@ user_buckets = {

hub_cloud_permissions = {
"staging" : {
requestor_pays : true,
bucket_admin_access : ["scratch-staging"],
extra_iam_policy : ""
},
"dask-staging" : {
requestor_pays : true,
bucket_admin_access : ["scratch-dask-staging"],
extra_iam_policy : ""
},
"showcase" : {
requestor_pays : true,
bucket_admin_access : [
"scratch-researchdelight",
"persistent-showcase"
],
extra_iam_policy : ""
},
"ncar-cisl" : {
requestor_pays : true,
bucket_admin_access : ["scratch-ncar-cisl"],
extra_iam_policy : ""
},
"go-bgc" : {
requestor_pays : true,
bucket_admin_access : ["scratch-go-bgc"],
extra_iam_policy : ""
},
"itcoocean" : {
requestor_pays : true,
bucket_admin_access : ["scratch-itcoocean"],
extra_iam_policy : ""
},
Expand Down
2 changes: 0 additions & 2 deletions terraform/aws/projects/catalystproject-africa.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ user_buckets = {

hub_cloud_permissions = {
"staging" : {
requestor_pays : true,
bucket_admin_access : ["scratch-staging"],
extra_iam_policy : ""
},
"prod" : {
requestor_pays : true,
bucket_admin_access : ["scratch"],
extra_iam_policy : ""
},
Expand Down
2 changes: 0 additions & 2 deletions terraform/aws/projects/earthscope.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ user_buckets = {

hub_cloud_permissions = {
"staging" : {
requestor_pays : true,
bucket_admin_access : ["scratch-staging"],
extra_iam_policy : ""
},
"prod" : {
requestor_pays : true,
bucket_admin_access : ["scratch"],
extra_iam_policy : ""
},
Expand Down
2 changes: 0 additions & 2 deletions terraform/aws/projects/gridsst.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ user_buckets = {

hub_cloud_permissions = {
"staging" : {
requestor_pays : true,
bucket_admin_access : ["scratch-staging"],
extra_iam_policy : ""
},
"prod" : {
requestor_pays : true,
bucket_admin_access : ["scratch"],
extra_iam_policy : ""
},
Expand Down
2 changes: 0 additions & 2 deletions terraform/aws/projects/jupyter-meets-the-earth.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ user_buckets = {

hub_cloud_permissions = {
"staging" : {
requestor_pays : true,
bucket_admin_access : ["scratch-staging"],
# FIXME: Previously, users were granted full S3 permissions.
# Keep it the same for now
Expand All @@ -34,7 +33,6 @@ hub_cloud_permissions = {
EOT
},
"prod" : {
requestor_pays : true,
bucket_admin_access : ["scratch"],
# FIXME: Previously, users were granted full S3 permissions.
# Keep it the same for now
Expand Down
2 changes: 0 additions & 2 deletions terraform/aws/projects/nasa-cryo.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ user_buckets = {

hub_cloud_permissions = {
"staging" : {
requestor_pays : true,
bucket_admin_access : ["scratch-staging", "persistent-staging"],
# Provides readonly requestor-pays access to usgs-landsat bucket
# FIXME: We should find a way to allow access to *all* requester pays
Expand Down Expand Up @@ -57,7 +56,6 @@ hub_cloud_permissions = {
EOT
},
"prod" : {
requestor_pays : true,
bucket_admin_access : ["scratch", "persistent"],
# Provides readonly requestor-pays access to usgs-landsat bucket
# FIXME: We should find a way to allow access to *all* requester pays
Expand Down
2 changes: 0 additions & 2 deletions terraform/aws/projects/nasa-esdis.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ user_buckets = {

hub_cloud_permissions = {
"staging" : {
requestor_pays : true,
bucket_admin_access : ["scratch-staging"],
extra_iam_policy : ""
},
"prod" : {
requestor_pays : true,
bucket_admin_access : ["scratch"],
extra_iam_policy : ""
},
Expand Down
2 changes: 0 additions & 2 deletions terraform/aws/projects/nasa-ghg.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ user_buckets = {

hub_cloud_permissions = {
"staging" : {
requestor_pays : true,
bucket_admin_access : ["scratch-staging"],
extra_iam_policy : <<-EOT
{
Expand Down Expand Up @@ -70,7 +69,6 @@ hub_cloud_permissions = {
EOT
},
"prod" : {
requestor_pays : true,
bucket_admin_access : ["scratch"],
extra_iam_policy : <<-EOT
{
Expand Down
2 changes: 0 additions & 2 deletions terraform/aws/projects/nasa-veda.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ user_buckets = {

hub_cloud_permissions = {
"staging" : {
requestor_pays : true,
bucket_admin_access : ["scratch-staging"],
extra_iam_policy : <<-EOT
{
Expand Down Expand Up @@ -75,7 +74,6 @@ hub_cloud_permissions = {
EOT
},
"prod" : {
requestor_pays : true,
bucket_admin_access : ["scratch"],
extra_iam_policy : <<-EOT
{
Expand Down
2 changes: 0 additions & 2 deletions terraform/aws/projects/openscapes.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@ user_buckets = {

hub_cloud_permissions = {
"staging" : {
requestor_pays : true,
bucket_admin_access : ["scratch-staging"],
extra_iam_policy : ""
},
"prod" : {
requestor_pays : true,
bucket_admin_access : ["scratch"],
extra_iam_policy : ""
},
Expand Down
2 changes: 0 additions & 2 deletions terraform/aws/projects/smithsonian.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ user_buckets = {

hub_cloud_permissions = {
"staging" : {
requestor_pays : true,
bucket_admin_access : ["scratch-staging"],
extra_iam_policy : ""
},
"prod" : {
requestor_pays : true,
bucket_admin_access : ["scratch"],
extra_iam_policy : ""
},
Expand Down
2 changes: 0 additions & 2 deletions terraform/aws/projects/template.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ user_buckets = {

hub_cloud_permissions = {
"staging" : {
requestor_pays : true,
bucket_admin_access : ["scratch-staging"],
extra_iam_policy : ""
},
"prod" : {
requestor_pays : true,
bucket_admin_access : ["scratch"],
extra_iam_policy : ""
},
Expand Down
2 changes: 0 additions & 2 deletions terraform/aws/projects/ubc-eoas.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ user_buckets = {

hub_cloud_permissions = {
"staging" : {
requestor_pays : true,
bucket_admin_access : ["scratch-staging"],
extra_iam_policy : ""
},
"prod" : {
requestor_pays : true,
bucket_admin_access : ["scratch"],
extra_iam_policy : ""
},
Expand Down
2 changes: 0 additions & 2 deletions terraform/aws/projects/victor.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ user_buckets = {

hub_cloud_permissions = {
"staging" : {
requestor_pays : true,
bucket_admin_access : ["scratch-staging"],
extra_iam_policy : ""
},
"prod" : {
requestor_pays : true,
bucket_admin_access : ["scratch"],
extra_iam_policy : ""
},
Expand Down
12 changes: 6 additions & 6 deletions terraform/aws/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,20 @@ variable "user_buckets" {
}

variable "hub_cloud_permissions" {
type = map(object({ requestor_pays : bool, bucket_admin_access : set(string), extra_iam_policy : string }))
type = map(object({
bucket_admin_access : set(string),
extra_iam_policy : string
}))
default = {}
description = <<-EOT
Map of cloud permissions given to a particular hub
Key is name of the hub namespace in the cluster, and values are particular
permissions users running on those hubs should have. Currently supported are:
1. requestor_pays: Identify as coming from the google cloud project when accessing
storage buckets marked as https://cloud.google.com/storage/docs/requester-pays.
This *potentially* incurs cost for us, the originating project, so opt-in.
2. bucket_admin_access: List of S3 storage buckets that users on this hub should have read
1. bucket_admin_access: List of S3 storage buckets that users on this hub should have read
and write permissions for.
3. extra_iam_policy: An AWS IAM Policy document that grants additional rights to the users
2. extra_iam_policy: An AWS IAM Policy document that grants additional rights to the users
on this hub when talking to AWS services.
EOT
}
Expand Down
4 changes: 2 additions & 2 deletions terraform/gcp/projects/awi-ciroh.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ dask_nodes = {

hub_cloud_permissions = {
"staging" : {
requestor_pays : false,
allow_access_to_external_requester_pays_buckets : false,
bucket_admin_access : ["scratch-staging", "persistent-staging"],
hub_namespace : "staging"
},
"prod" : {
requestor_pays : false,
allow_access_to_external_requester_pays_buckets : false,
bucket_admin_access : ["scratch", "persistent"],
hub_namespace : "prod"
}
Expand Down
2 changes: 1 addition & 1 deletion terraform/gcp/projects/daskhub-template.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ user_buckets = {

hub_cloud_permissions = {
"{{ hub_name }}" : {
requestor_pays : true,
allow_access_to_external_requester_pays_buckets : true,
bucket_admin_access : ["scratch-{{ hub_name }}"],
hub_namespace : "{{ hub_name }}"
},
Expand Down
4 changes: 2 additions & 2 deletions terraform/gcp/projects/leap.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ user_buckets = {

hub_cloud_permissions = {
"staging" : {
requestor_pays : true,
allow_access_to_external_requester_pays_buckets : true,
bucket_admin_access : ["scratch-staging", "persistent-staging"],
bucket_readonly_access : ["persistent-ro-staging"],
hub_namespace : "staging"
},
"prod" : {
requestor_pays : true,
allow_access_to_external_requester_pays_buckets : true,
bucket_admin_access : ["scratch", "persistent"],
bucket_readonly_access : ["persistent-ro"],
hub_namespace : "prod"
Expand Down
4 changes: 2 additions & 2 deletions terraform/gcp/projects/linked-earth.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ dask_nodes = {

hub_cloud_permissions = {
"staging" : {
requestor_pays : false,
allow_access_to_external_requester_pays_buckets : false,
bucket_admin_access : ["scratch-staging"],
hub_namespace : "staging"
},
"prod" : {
requestor_pays : false,
allow_access_to_external_requester_pays_buckets : false,
bucket_admin_access : ["scratch"],
hub_namespace : "prod"
}
Expand Down
Loading

0 comments on commit 31796fa

Please sign in to comment.