Skip to content

Commit

Permalink
Document how to test if buckets are fully set up
Browse files Browse the repository at this point in the history
  • Loading branch information
yuvipanda committed Mar 26, 2024
1 parent cfd5ac1 commit 4495d7d
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions docs/howto/features/buckets.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,75 @@ on why users want this!
4. Get this change deployed, and users should now be able to use the buckets!
Currently running users might have to restart their pods for the change to take effect.

### Testing access to buckets

Once bucket access has been set up, we should test to make sure users can write
to and read from it.

#### AWS

1. Login to the hub, and open a Terminal in JupyterLab

2. Check if the AWS CLI is installed by running the `aws` command - many base images
already include this package. If not, you can do a local installation with:

```bash
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
export PATH=$(pwd)aws/dist/:$PATH
```

```{note}
This could have been as simple as a `pip install`, but [AWS does not support it](https://github.com/aws/aws-cli/issues/4947)
```

3. Create a temporary file, which we will then copy over to our scratch bucket.

```bash
echo 'hi' > temp-test-file
```

4. Copy the file over to S3, under `$SCRATCH_BUCKET` or `$PERSISTENT_BUCKET` (based on
which one we are going to be testing).

```bash
aws s3 cp temp-test-file $SCRATCH_BUCKET/temp-test-file
```

This should succeed with a message like `upload: ./temp-test-file to s3://openscapeshub-scratch/yuvipanda/temp-test-file`

5. Let's list our bucket to make sure the file is there.

```bash
$ aws s3 ls $SCRATCH_BUCKET/
2024-03-26 01:38:53 3 temp-test-file
```

```{note}
The trailing `/` is important.
```

```{note}
If testing `$PERSISTENT_BUCKET`, use that environment variable instead
```

6. Copy the file back from s3, to make sure we can read.

```bash
$ aws s3 cp $SCRATCH_BUCKET/temp-test-file back-here
download: s3://openscapeshub-scratch/yuvipanda/temp-test-file to ./back-here
$ cat back-here
hi
```

We have verified this all works!

7. Clean up our files so we don't cost the community money in the long run.

```bash
aws s3 rm $SCRATCH_BUCKET/temp-test-file
rm temp-test-file back-here
```

## Allowing public, readonly to buckets from outside the JupyterHub

Expand Down

0 comments on commit 4495d7d

Please sign in to comment.