> For the complete documentation index, see [llms.txt](https://help.bioinsight.illumina.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.bioinsight.illumina.com/emedgene/emedgene-analyze-manual/managing_data_storage/storage-providers/manage-gcs-storage-v37.0+.md).

# Manage Google Cloud storage

## Google Cloud Storage Credentials update procedure

### How to get the client credentials?

1. Go to the google cloud Console.
2. Navigate to IAM & Admin - In the left sidebar, go to IAM & Admin > Service Accounts.

<figure><img src="https://1131024994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGCW0DnLlE7QjoZPNmKIi%2Fuploads%2Fgit-blob-96be889723639cfdc06536a0442b5825738de852%2Fimage%20(18).png?alt=media" alt="" width="358"><figcaption></figcaption></figure>

3. Create a New Service Account: Click on the "Create Service Account" button at the top.

<figure><img src="https://1131024994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGCW0DnLlE7QjoZPNmKIi%2Fuploads%2Fgit-blob-afb1b5b2de52cb3b6cd8ce49188581748d390801%2Fimage%20(4)%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

3. Fill in the Service Account Details:

   * Service account name: Give your service account a name.
   * Service account ID: This will be automatically generated based on the name.
   * Description: Optionally, provide a description for the service account.

   Click "Create and Continue".

   **example**:

<figure><img src="https://1131024994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGCW0DnLlE7QjoZPNmKIi%2Fuploads%2Fgit-blob-24d95476b37fadf417ccd009348fb3f605fd9646%2Fimage%20(5)%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

3. Assign Roles to the Service Account:
   * In the Grant this service account access to project step, you’ll assign the necessary roles.
   * Grant these role:
     * "storage object viewer" (read-only access)
4. Create the Service Account:
   * After assigning the roles, click "Done".
5. Generate and Download a Key:
   * Find your newly created service account, click the three dots on the right,\
     and select "Manage Keys".
   * Click Add Key > Create New Key and choose the JSON format.
   * Download the key and store it securely, as it is used for authentication in your code or applications.
6. Encode the key in base 64:
   * use python function: put this function and your json (here named json\_file.json) in the same directory and run.\\

     ```
     import json
     import base64


     def encode_json_to_base64(json_file):
         # Read JSON data from file
         with open(json_file, 'r') as file:
             json_data = json.load(file)

         # Convert the JSON data to a string
         json_str = json.dumps(json_data)

         # Encode the string to bytes, then to Base64
         json_bytes = json_str.encode('utf-8')
         base64_bytes = base64.b64encode(json_bytes)

         # Convert Base64 bytes back to a string
         base64_str = base64_bytes.decode('utf-8')
         # Print the Base64-encoded string
         print(base64_str)


     encode_json_to_base64('json_file.json')
     ```
   * save the output printed.

### Add the storage provider to Emedgene platform:

* Add the above 3 values into the appropriate fields:
  * Client\_credentials\_base64: pasting the output of 8.
  * Bucket: the bucket name.
  * Path: for default, fill with /\
    else, put your path in the bucket. Seperate directories with /

<figure><img src="https://1131024994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGCW0DnLlE7QjoZPNmKIi%2Fuploads%2Fgit-blob-e32eb5e308e68e3d5cadbfafb38b4a4799d0f0bd%2Fimage%20(17).png?alt=media" alt=""><figcaption></figcaption></figure>

### CORS - Visualisation

1. Download and install the Google Cloud SDK from the Google Cloud SDK Install page. [LINK](https://cloud.google.com/sdk/docs/install)
2. Select Your Platform (Windows, macOS, or Linux), download and run.
3. Initialize and Authenticate with Google Cloud: In the Cloud SDK Shell/terminal, run:\
   `gcloud init`\
   This will open a browser window to authenticate your Google account. Follow the instructions to log in and select your project.
4. Set CORS Configuration via gcloud:\
   Create a JSON file (`cors.json`) on your machine with the CORS rules.\
   Example\ it should look like:

   ```
   [
       {
         "origin": ["https://<host_name>.emg.illumina.com"],
         "method": ["GET"],
         "responseHeader": ["emgauthorization"],
         "maxAgeSeconds": 3600
       }
   ]
   ```

**notice:**

* origin: if using Illumina cloud:

  <https://host\\_name.emg.illumina.com>

  else, Emedgene cloud:

  <https://host\\_name.emedgene.com>

1. Apply CORS Configuration to Your Bucket: run the next command.\
   `gcloud storage buckets update gs://your-bucket-name --cors-file=cors.json`
2. Verify the CORS Configuration:\
   `gcloud storage buckets describe gs://your-bucket-name`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.bioinsight.illumina.com/emedgene/emedgene-analyze-manual/managing_data_storage/storage-providers/manage-gcs-storage-v37.0+.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
