Create storage buckets

Create 2 storage buckets

GoTo: Cloud Storage > buckets > create (link)

  1. Create a publicly accessible bucket for facility images:

    1. Name: <prefix>-care-facility

    2. Location type: Region

    3. Location: asia-south1 (Mumbai)

    4. Default storage class: Standard

    5. Public access prevention: Off

    6. Access control: Uniform

    7. Protection tools: None

  2. Create a private bucket for patient data.

    1. Name: <prefix>-care-patient-data

    2. Location type: Region

    3. Location: asia-south1 (Mumbai)

    4. Default storage class: Standard

    5. Public access prevention: On

    6. Access control: Uniform

    7. Protection tools: Retention policy: 7 days

Setup access keys

Go to Cloud Storage > Settings > Interoperability (link)

  1. Under Access keys for service accounts, click on Create a key for a service account

  2. Click create a new service account:

    1. Name: care-bucket-access

    2. Click “Create and continue”

    3. Role: Storage Object Admin under Cloud Storage

    4. Click "Continue" then "Done"

  3. Select care-bucket-access and click on create key

  4. Note down the Access key and Secret for later

Configure CORS:

  1. Activate Cloud Shell

  2. Create a file bucket-config.json with the following contents

[
   {
     "origin": ["https://care.ohc.network", "https://care.coronasafe.in"],
     "method": ["GET", "PUT"],
     "responseHeader": ["*"],
     "maxAgeSeconds": 3600
   }
]
  1. Replace the origin with your deployed frontend URLs

  2. Apply config for buckets using gcloud cli

gcloud storage buckets update gs://<prefix>-care-facility --cors-file=bucket-config.json
gcloud storage buckets update gs://<prefix>-care-patient-data --cors-file=bucket-config.json

Last updated