# GCP GCS

This guide explains how to connect GCP Cloud Storage to the Weekerp API.

It includes the full process of creating credentials and registering them in Weekerp.

#### Required information for connection

To allow Weekerp to access your images, you need to provide the following:

* service account key (JSON)
  * Client email
  * Project Id
  * private key
* bucket name

#### Getting credentials (GCP)

If you’re not familiar with GCP, we recommend creating a new **read-only Service Account** so Weekerp can read images from your bucket.

1. Open the GCP Console → **Service Accounts** → **Create service account**
2. Enter a Service Account name (e.g., `weekerp-cdn-reader`) → **Create and Continue**
3. Set the role → search/select **Storage Object Viewer** → **Done**
4. Select the created Service Account → **Keys** tab → **Add Key** → **Create new key** → **JSON** → **Create**
5. Save the downloaded JSON key file (**do not share externally**).
6. In the GCP Console → **Buckets**, confirm the **Bucket name** to connect.
7. In Weekerp → **Sources** → **Add Source** → **Google Cloud Storage (GCS)**
8. Enter the **Bucket name** + upload the **JSON key file** → **Next**
9. Enter an **Alias** and create it to add the source.

#### Below is the same guide shown in images.

#### 1. Search for **“Service Accounts”** in the GCP Console

<figure><img src="https://2148242329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxGV4or1Scr0ygVH4EZcP%2Fuploads%2FMlIoZ7OLn6THdbmF3kpm%2F1.png?alt=media&#x26;token=b5614cd5-2610-4d5a-9929-570ef2b33f37" alt=""><figcaption></figcaption></figure>

#### 2. Click **“Create service account”**

<figure><img src="https://2148242329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxGV4or1Scr0ygVH4EZcP%2Fuploads%2FZGDx3TZ8MgAoGJQLssGS%2F2.png?alt=media&#x26;token=1731fefb-93b6-4e52-b46e-1dbcc859bd6a" alt=""><figcaption></figcaption></figure>

#### 3. Create a Service Account

1. Enter `weekerp-cdn-reader` (you can change this)
2. Click **Create and Continue**

<figure><img src="https://2148242329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxGV4or1Scr0ygVH4EZcP%2Fuploads%2FYCUgqDB8toorBQBxQHVL%2F3.png?alt=media&#x26;token=15649d71-3c13-4260-8414-dc985b81d992" alt=""><figcaption></figcaption></figure>

#### 4. Grant permissions to the account, and open the **Role** dropdown

<figure><img src="https://2148242329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxGV4or1Scr0ygVH4EZcP%2Fuploads%2FxshjagZ0qBeY7ZEZrATl%2F4.png?alt=media&#x26;token=a56d84cf-3e6a-48a5-8c15-de9a7acccf17" alt=""><figcaption></figcaption></figure>

#### 5. Search and assign **Storage Object Viewer**

1. Search for **Storage Object Viewer**
2. Click **Storage Object Viewer** at the top of the results

<figure><img src="https://2148242329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxGV4or1Scr0ygVH4EZcP%2Fuploads%2FuHiOg1OY8WqNDLJSZmye%2F5.png?alt=media&#x26;token=9b9bbc68-bb07-491d-97e2-37fa26243068" alt=""><figcaption></figcaption></figure>

#### 6. Finish granting permissions

1. Click **Done**

<figure><img src="https://2148242329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxGV4or1Scr0ygVH4EZcP%2Fuploads%2FMOGHBngO2lhyOzhXBBlz%2F6.png?alt=media&#x26;token=c3059dd2-63db-4228-bc49-393efbd04701" alt=""><figcaption></figcaption></figure>

#### 7. Verify the created account and open its details

1. Confirm the created account
2. Click the account name

<figure><img src="https://2148242329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxGV4or1Scr0ygVH4EZcP%2Fuploads%2FW9ZT583TN7gXD4ocVmEX%2F7.png?alt=media&#x26;token=5b0e2146-eaf3-4cdd-b29f-9babe5739be1" alt=""><figcaption></figcaption></figure>

#### 8. Create a key (JSON)

1. Click the **Keys** tab
2. Click **Add Key**
3. From the dropdown, click **“Create new key”**

<figure><img src="https://2148242329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxGV4or1Scr0ygVH4EZcP%2Fuploads%2Fvrta7fwgJDhOQNEkXpsC%2F8.png?alt=media&#x26;token=0e0506a6-c7cd-476c-9bd2-0a28adc050a4" alt=""><figcaption></figcaption></figure>

#### 9. Select the key type

1. Choose **JSON**
2. Click **Create** (bottom-right)

<figure><img src="https://2148242329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxGV4or1Scr0ygVH4EZcP%2Fuploads%2FbKZu5jvgD5ZDFWPef80I%2F9.png?alt=media&#x26;token=67bbb75c-e938-4f38-a117-528e925c06bc" alt=""><figcaption></figcaption></figure>

#### 10. Verify the downloaded key file (`.json`)

After downloading the JSON file, you’ll receive a key like the following (**do not share externally**).

```json
{
  "type": "service_account",
  "project_id": "weekerp-cdn-test",
  "private_key_id": "4e393a5fe31bfa11fecb5eae0d47d4603fe681d5",
  "private_key": "-----BEGIN PRIVATE KEY-----\\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCWuvmrL083KrOK\\nJW/IH/GX3rBmOjfWneJb4jFCQadoQFChtTW9TUJCwtFpSGOSJ6wmIJSNG2QJWuIn\\nnTKeAKnAGQsFA2ezlSkfjUZ2mOx+6CZidZhIQIsTvVqjp2LJf+SM+oeRFwVEIgiJ\\n4bzjtxra1HAeAjR9AeSxQBvJDc2SXBXpUznDS8nD3Z/52M4A66+WAAOwqCWPey4l\\n17ahHE6vN9BBAi5puTBa1Q/YJt7O8ELH6KJA4MbYqenvJmTIQImQeDb+gcGzb1Ka\\n3hVyn4uU4G89mTMMtWPAINu9jU9Q2sX2xrFuzMDDRlpmABbVtH29sZzn2TpkvJdp\\nT/J+h6z3AgMBAAECggEAFc7TlKrxoR+yfkhQVfoZMEnt57yAm7KYL4cYbWemWvUD\\nNYJMVik5bwNU3RC2J01KIPIRzCCsZpYZpnWd/zJFXR/CcmU9ucPZAVGlYj9Z6Dqa\\nYyB0ee+sr5xz4r2zE0hHvwX4W0ujXWo3JgvdEm1Jm2OlHRJgmb2OYv7NhldS6Nvk\\n+4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K6/x\\nKquzm/b2ZXFh52bmn1Po6tsb\\n-----END PRIVATE KEY-----\\n",
  "client_email": "weekerp-cdn-reader@weekerp-cdn-test.iam.gserviceaccount.com",
  "client_id": "109823219863817160893",
  "auth_uri": "<https://accounts.google.com/o/oauth2/auth>",
  "token_uri": "<https://oauth2.googleapis.com/token>",
  "auth_provider_x509_cert_url": "<https://www.googleapis.com/oauth2/v1/certs>",
  "client_x509_cert_url": "<https://www.googleapis.com/robot/v1/metadata/x509/weekerp-cdn-reader%40weekerp-cdn-test.iam.gserviceaccount.com>",
  "universe_domain": "googleapis.com"
}

```

#### 11. Search for **Buckets** in the GCP Console (to confirm the bucket name)

<figure><img src="https://2148242329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxGV4or1Scr0ygVH4EZcP%2Fuploads%2FFv37MvQ8HhgLVumkeTDA%2F11.png?alt=media&#x26;token=5453da14-6f29-490a-bf09-00096d7d2560" alt=""><figcaption></figcaption></figure>

#### 12. Confirm the **Bucket name**

1. Example: `weekerp-test-2`

<figure><img src="https://2148242329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxGV4or1Scr0ygVH4EZcP%2Fuploads%2F3LyWtfHV3DgTxSai6w3a%2F12.png?alt=media&#x26;token=033e24a3-7423-4f46-ab74-fa76d328b183" alt=""><figcaption></figcaption></figure>

#### 13. You should have the following information ready:

1. Credential JSON file (Step #10)
2. Bucket name (Step #12)

#### 14. In Weekerp, click **Add Source** (top-right)

1. Open Weekerp
2. Click the **Source** tab
3. Click **Add Source**

<figure><img src="https://2148242329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxGV4or1Scr0ygVH4EZcP%2Fuploads%2FwLHq2swFZhgRf0nwlN6C%2F14.png?alt=media&#x26;token=c915c30b-bc2a-431d-9cba-cbfdf32197fd" alt=""><figcaption></figcaption></figure>

![image.png](attachment:723b0ba7-b34a-4b4c-af8a-9d37b718dbb8:image.png)

#### 15. Select **Google Cloud Storage**

<figure><img src="https://2148242329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxGV4or1Scr0ygVH4EZcP%2Fuploads%2FWNp5nwp5vCipwMozusEh%2F15.png?alt=media&#x26;token=b0ba5aac-1bcb-44c0-948f-4024f9fc8bf9" alt=""><figcaption></figcaption></figure>

![image.png](attachment:03ebaadb-3563-422a-9173-24afb19913e8:image.png)

#### 16. Enter credential information

1. Enter the **Bucket name**
2. Upload the **JSON file**

<figure><img src="https://2148242329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxGV4or1Scr0ygVH4EZcP%2Fuploads%2FIcOFHpHYR5JLgLD6tHCm%2F16.png?alt=media&#x26;token=d811ed63-2d3e-4194-a97c-2c0f68b6a1a5" alt=""><figcaption></figcaption></figure>

![Frame 7.png](attachment:e75720cd-cc2a-420f-a29c-a798a84aed8f:Frame_7.png)

{% hint style="info" %}
**BasePath** sets the root directory for origin requests.
{% endhint %}

If your files are stored like below, you can set BasePath to `/` or `/assets`.

* /dog.jpg
* /assets/cat.png

**Request example**

* `cdn.weekerp.com/image/{alias}/dog.jpg`

**Origin request**

* **With BasePath set:** <https://static.example.com/**`assets`**/dog.jpg>
* **Without BasePath:** <https://static.example.com/dog.jpg>

For more details, please refer to [basepath](https://weekerp.gitbook.io/image/storage/basepath "mention").

#### 17. Review the entered information

1. Confirm the details
2. Click **Next**

<figure><img src="https://2148242329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxGV4or1Scr0ygVH4EZcP%2Fuploads%2F0CWzUeBOYEoDshvk9niD%2F17.png?alt=media&#x26;token=a4529005-d01f-4850-b75d-6e44dc1d4968" alt=""><figcaption></figcaption></figure>

![image.png](attachment:dd65b12a-9086-4e91-9f04-92429af41bf2:image.png)

#### 18. Enter the source alias

1. Enter the alias you want to use
2. Create the alias

<figure><img src="https://2148242329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxGV4or1Scr0ygVH4EZcP%2Fuploads%2FqtyEOdT7mPiqT6rnMjCt%2F18.png?alt=media&#x26;token=0502bc7c-6386-4ce1-818c-d33acbfc8931" alt=""><figcaption></figcaption></figure>

![image.png](attachment:b8c17ea6-cade-447f-af48-28095e9b2359:image.png)

#### 19. Verify the created data source

<figure><img src="https://2148242329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxGV4or1Scr0ygVH4EZcP%2Fuploads%2FxJv0Vhswnlc4TiAqyQZP%2F19.png?alt=media&#x26;token=d2e06076-5689-472e-9a69-929c3686fc01" alt=""><figcaption></figcaption></figure>

![image.png](attachment:b512cd7d-3a62-43ac-bbe6-c99394488c84:image.png)

#### Use it like this:

cdn.weekerp.com/<mark style="color:red;">`image`</mark>/`weekerp-assets`/dog.jpg

cdn.weekerp.com/<mark style="color:red;">`image`</mark>/`weekerp-assets`/dog.jpg?ai=Rotate the image to the right

cdn.weekerp.com/<mark style="color:red;">`video`</mark>/`weekerp-assets`/test-video.mp4

All settings are complete.

In general, it takes about **5–10 minutes** to propagate the connection across all global environments.
