This Python script generates a signed URL for downloading a blob from Google Cloud Storage (GCS). The signed URL allows users to access the blob without requiring authentication.
- Python >= 3.10.x
- Google Service Account
$ export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/service-account-file.json"
$ python3 gcs-sign.py -h
usage: gcs-sign.py [-h] -b BUCKET_NAME -o BLOB_NAME -e EXPIRATION
Generate a signed URL for a Google Cloud Storage blob.
options:
-h, --help show this help message and exit
-b BUCKET_NAME, --bucket-name BUCKET_NAME
The name of the GCS bucket
-o BLOB_NAME, --blob-name BLOB_NAME
The name of the blob in the bucket
-e EXPIRATION, --expiration EXPIRATION
The expiration time in minutes for the signed URL