# GCP Cloud Setup

To complete the **"Connect to Your Cloud Account"** step in the deX platform, you'll need to configure a few resources in your GCP console. Once this is complete, you’ll receive a Service Account JSON key to use within dex.

### Create a GCP Project for dex

1. Open the Google Cloud Console.
2. Click **New Project**.
3. Fill in the required fields:
   * Name your project something like `your-org-lakehouse`
   * Choose a **Location** with your SRE or infra team for optimal cost/performance
4. Click **Create**

{% hint style="info" %}
Tip: In production, you may want separate projects for `dev` and `prod`. For this quickstart, one is enough.
{% endhint %}

{% embed url="<https://youtu.be/HSeTvUWjOoA>" %}
Creating a New Project on Google Cloud Console
{% endembed %}

### Create Cloud Credentials

dex needs specific GCP permissions to operate. We’ve made this easy with a setup script.

For reference, these are the permissions dex needs (generated by the setup script). You can read the full list of permissions and what they do [here](https://cloud.google.com/iam/docs/allow-policies).

{% code overflow="wrap" %}

```
storage.managedFolders.delete
storage.managedFolders.get
storage.managedFolders.list
storage.multipartUploads.abort
storage.multipartUploads.create
storage.multipartUploads.list
storage.multipartUploads.listParts
storage.objects.create
storage.objects.delete
storage.objects.get
storage.objects.list
storage.objects.restore
storage.objects.update
bigquery.datasets.create
bigquery.datasets.get
bigquery.datasets.getIamPolicy
bigquery.jobs.create
bigquery.models.getMetadata
bigquery.models.list
bigquery.routines.get
bigquery.routines.list
bigquery.tables.create
bigquery.tables.get
bigquery.tables.getData
bigquery.tables.getIamPolicy
bigquery.tables.list
bigquery.tables.update
bigquery.tables.updateData
dataplex.projects.search
resourcemanager.projects.get
```

{% endcode %}

### Set Up GCP Credentials with Cloud Shell

To configure access between dex and BigQuery, follow these steps using Google Cloud Shell:

1\. Open the [GCP Console](https://console.cloud.google.com/)

2\. In the top bar, click on the project selector and choose the project you created or reserved for dex.

3\. Launch Cloud Shell Editor - Use the search bar at the top of the page to search for `Cloud Shell Editor` and click to open it.

4\. Inside the Cloud Shell Editor, click the **"Open Terminal"** button near the top of the screen.

5\. Paste the following command into the terminal to download the setup script:

{% code overflow="wrap" %}

```bash
wget https://raw.githubusercontent.com/dexlabsio/terraform-modules/refs/heads/main/gcp/cloud-shell/bigquery-service-account-setup.py
```

{% endcode %}

6\. Set your GCP project ID in the shell environment

```bash
export GOOGLE_CLOUD_PROJECT=$(gcloud config get-value project)
```

7\. Execute the setup script

```bash
python3 bigquery-service-account-setup.py
```

8\. Download your Service Account Key

After running the script, you’ll receive a **Service Account JSON key** on the screen

{% hint style="info" %}
Download and store this key securely — you’ll need it when connecting dex to BigQuery.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dexlabs.io/lakehouse-platform/set-up-dex/gcp-cloud-setup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
