There are multiple parts to setting up a GCP integration in Encord:

  1. Start setting up the integration in Encord.
  2. Grant service account access and register your storage bucket with Encord.
  3. Set up a CORS configuration.

Ensure all objects in the bucket use the Standard Storage class.

1. Start setting up the integtation

  1. In the Integrations section of the Encord platform, click +New integration to create a new integration and select GCP.
  1. Give your integration a meaningful title.

2. Grant service account access

  1. Log into your Google Cloud account and navigate to the GCP bucket you want to integrate with Encord.

  2. Click Grant Access to add a service account for Encord, in the bucket’s PERMISSION tab.

  3. Add ’cord-cloud-storage-integrator@cord-ai-platform.iam.gserviceaccount.com’ as a New Principal and assign the following roles:

  • Storage Object Viewer
  • Storage Object Creator

2.1 Register the cloud bucket with Encord

Paste the name of your GCP bucket into Step 2.1 of the integration in Encord.

3. Create a CORS configuration

A CORS configuration must to be applied to the bucket you want to integrate with Encord. A CORS configuration enables Encord to request resources from the specified bucket.

The only way to create a CORS configuration is using the command line, or terminal tool.

Install Google’s Cloud CLI, and use the following gcloud command in your command line or terminal to create a CORS configuration.

gcloud storage buckets update  gs://<YOUR_BUCKET_NAME> --cors-file="/path/to/you/cors.json"
  • Replace <YOUR_BUCKET_NAME> with the name of the bucket you want to integrate.
  • Replace /path/to/you/cors.json with the full path to your JSON CORS file. A sample JSON file is provided below.

Click Create in Encord to finish creating the integration, after creating a CORS configuration.

JSON configuration file

The following JSON file can be used to set up the CORS configuration in Step 3 of your GCP integration.

[
    {
      "origin": ["https://app.encord.com", "https://api.encord.com", "https://dicom.encord.com"],
      "method": ["GET"],
      "responseHeader": ["Content-Type"],
      "maxAgeSeconds": 3600
    }
]
  • Preflight requests are valid for 1 hour. Use the maxAgeSeconds variable to adjust the number of seconds the browser is allowed to make requests before it must repeat the preflight request.
  • Successful browser requests return the Content-Type of the resource in the response, as set by the responseHeader.

Consult the GCP documentation, to customize the file further.

4. Testing your integration

Click the Run a test button on the integration to test the integration.

Paste the URL of any object in the bucket and click Check Encord can access this URL. If the test is successful a green tick appears next to Encord infrastructure and This machine.


Upload GCP data

See the Upload cloud data page for guidance on how to create a upload data stored in GCP.

We recommend setting the expiration time for pre-signed URLs (found in your cloud storage settings) to be greater than the time it takes to complete an annotation task. More information can be found in the GCP documentation.