Skip to content

About

Scripts to facilitate secure data uploads to S3.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

data-commons-upload-utils

Roles

  • receiver — owns the S3 bucket & generates presigned URLs.
  • sender — is the source of the data, and runs the upload.
usecase-beta
direction LR
actor Receiver
actor Sender
systemBoundary Transfer["S3 data transfer"]
  Issue("Issue upload config")
  Upload("Upload a folder")
end
Receiver --> Issue
Sender --> Upload
Loading

issue-upload-config.py

Used by the receiver to generate a presigned POST URL as a curl config file. This contains the ${filename} suffix and can be used to upload multiple files in a directory.

Requirements

  • python3 (tested with python 3.14)
  • boto3

Install requirements

pip install --user boto3

Make the script executable

chmod +x issue-upload-config.py

Usage

usage: issue-upload-config.py [-h] --bucket BUCKET --profile PROFILE
                              [--expires-in SECONDS]
                              --upload-label UPLOAD_LABEL
                              --data-type DATA_TYPE

Issue a presigned S3 POST as a curl config. By convention, files are uploaded
to <bucket>/data/<upload-label>/<data-type>

options:
  -h, --help            show this help message and exit
  --bucket BUCKET       S3 bucket name in ap-southeast-2
  --profile PROFILE     AWS profile used to sign the upload
  --expires-in SECONDS  POST validity in seconds (default: 604800)
  --upload-label UPLOAD_LABEL
                        Transfer folder under data/. Example convention:
                        <YYYY-MM-DD>_<Study>_ACDC_Data_Transfer
  --data-type DATA_TYPE
                        Data type folder under the transfer. Example:
                        lipidomic

Example:

./issue-upload-config.py \
  --bucket abcd \
  --profile MyProfile \
  --upload-label 2026-11-30_MCCS_ACDC_Data_Transfer \
  --data-type lipidomic > curl.conf

Securely transfer the curl.conf output file to the receiver.

upload.sh

Used by the sender to upload files to the receiving bucket.

Requirements

  • bash
  • curl >= 7.81
  • find with print0 support

Usage

  1. Obtain the curl.conf file from the receiver and save to a location outside the source directory.
  2. Edit upload.sh to set SOURCE_DIR and CURL_CONFIG.
  3. Run the script:
bash upload.sh

The expected output is a reported HTTP 204 for each successful upload.

About

Scripts to facilitate secure data uploads to S3.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages