Skip to content

Instantly share code, notes, and snippets.

@garystafford
Last active August 11, 2018 02:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garystafford/6b00f2bd2ffb85fc93dc092703456618 to your computer and use it in GitHub Desktop.
Save garystafford/6b00f2bd2ffb85fc93dc092703456618 to your computer and use it in GitHub Desktop.
#!/usr/bin/env sh
# author: Gary A. Stafford
# site: https://programmaticponderings.com
# license: MIT License
set -ex
# Set constants
PROJECT_ID="<your_project_id>"
REGION="<your_region>"
IMAGE_BUCKET="<your_bucket_name>"
# Create GCP Storage Bucket
gsutil mb \
-p ${PROJECT_ID} \
-c regional \
-l ${REGION} \
gs://${IMAGE_BUCKET}
# Upload images to bucket
for file in pics/image-*; do
gsutil cp ${file} gs://${IMAGE_BUCKET}
done
# Make all images public in bucket
gsutil iam ch allUsers:objectViewer gs://${IMAGE_BUCKET}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment