<p>As it turns out, the initial issue was my server time not being set as Google Cloud wanted. I'm in the UK and using a server in Germany. I set it so the time synched with time1.google.com and that fixed my first issue.</p>

<p>Another problem popped up after that (unknown error!) but Craft support got in there and patched the issue for me so i'm good to go (and hopefully others in future wont have that problem! Sweet!) </p>

CC BY-SA 3.0
2015-02-20T14:25:16.997Z
2015-02-20T14:25:16.997Z
Dan Owen
<p><strong>Craft 3:</strong></p>

<p>Once you have created your project in GC, navigate to GC Storage.</p>

<ol>
<li><p>Create a bucket. You can only create a bucket containing the domain name if you are able to prove ownership. For example, I (personally) could not create <code>files.craftcms.com</code> as my bucket. Otherwise it can be anything you'd like. Or check out the <a href="https://cloud.google.com/storage/docs/naming" rel="nofollow noreferrer">Bucket and Object Naming Guidelines</a></p></li>
<li><p>Navigate to IAM &amp; admin. We'll need to create a Service Account that can be used to give Craft access to the bucket.</p></li>
<li><p>Give your Service account a name. For example, "Cloud Storage". Google will create a service account ID that will look something like <code>cloud-storage@&lt;project-name&gt;.iam.gserviceaccount.com</code>. For Project Role, (you can filter) but choose "Storage Admin". You'll also want to select the checkbox labeled, "Furnish a new private key". Choose <code>json</code> as the format and click "Save".</p></li>
<li><p>A file will be downloaded to your computer - awesome. Next install the <a href="https://github.com/craftcms/google-cloud" rel="nofollow noreferrer">Google Cloud Plugin for Craft</a>: <code>composer require craftcms/google-cloud</code></p></li>
<li><p>Once installed, create a new Asset Resource and instead of "Local" choose "Google Cloud Storage" as a volume type.</p></li>
<li><p>Give your resource a name. For example, "Images". If you choose to have public url's use this url: <code>http://storage.googleapis.com/</code>. Unless you have a specific DNS record set up to serve images from that you want to use, you could do that too. Enter the project ID of your project. You can find that by clicking on your project name - very top (blue) nav bar. For example, it could be <code>my-project</code></p></li>
<li><p>Finally, remember that <code>.json</code> file that was downloaded? Open that with your favorite text editor and paste the contents into "Contents of the access key file". Hit the "Refresh" button, and you should now see the name of your primary bucket. In my case <code>files.mysite.com</code>. You might also notice that Craft will update the base url to the files: <code>http://storage.googleapis.com/files.mysite.com/</code></p></li>
</ol>

<p>From there, you could create sub-folders in GCS. In my case, I've created one called images. I will update that in the Subfolder input: <code>images</code>.</p>

<p>Save your newly created resource!</p>

CC BY-SA 4.0
2018-11-26T15:17:22.630Z
Great walkthough. I then received errors that the Cloud Storage Console API needed allowing for the project. I sorted that, then had to add credentials for it. The private_key_id proved to be the same as the one in the JSON.
Clive Portman
CC BY-SA 4.0
2018-12-06T12:06:54.887Z
And even after this, the images weren't showing publicly. This sorted it: Making groups of objects publicly readable section on https://cloud.google.com/storage/docs/access-control/making-data-public
Clive Portman
CC BY-SA 4.0
2021-10-28T10:19:37.190Z
Now that project configuration files are available, how do you add the json without having this end up in the configuration files? I'm having some issues with the authentication when I try to put it in .env, see here: https://craftcms.stackexchange.com/questions/38536/unable-to-use-credentials-json-from-env-file-for-google-cloud-storage
cballenar
CC BY-SA 4.0
2018-09-03T02:54:46.127Z
2018-09-03T02:54:46.127Z
Damon
<p>I've been clattering around the google developers console for a while, and i just can't get it to work with Craft! I figured it'd be simple (and it may well be!) considering in Craft it just asks for two bits of data, "Access Key ID" and "Secret Access Key".</p>

<p>After an age of digging about in the google developes console site and a bit of searching, i  ended up in the Project Dashboard for my Cloud Storage.
Enabling "Interoperable Access" gave me some new tabs on the side, one of which is "Interoperable Access", and in there FINALLY i found two strings that have the names "Access Key" and "Secret".</p>

<p>Putting them into Craft and hitting refresh next to Bucket gives me the error "Credentials rejected by target host".</p>

<p>And so now i'm stumped! Does anyone have experience using Google Cloud Storage with Craft who can point me in the right direction?</p>

CC BY-SA 3.0
2015-02-20T00:55:09.027Z
@DanOwen Please post your solution as an answer below and accept it as the correct answer by clicking on the checkbox. You might have to wait 24hrs before you can accept it so just remember to come back to do that.
Anna_MediaGirl
CC BY-SA 3.0
2015-02-09T12:57:21.950Z
Probably best to reproduce this error and then send us a support ticket using the dashboard widget and including the log files.
Andris Sevcenko
CC BY-SA 3.0
2015-02-11T15:36:27.513Z
Thanks Andris! Really fast and awesome support :)

For anyone else having this kind of problem...
As it turns out, the initial issue was my server time not being set as Google Cloud wanted. I'm in the UK and using a server in Germany. I set it so the time synched with time1.google.com and that fixed my first issue.

Another problem popped up after that (unknown error!) but Craft support got in there and patched the issue for me so i'm good to go (and hopefully others in future wont have that problem! Sweet!)
Dan Owen
<assets>
How to set up Craft to use Google Cloud Storage?
# How to set up Craft to use Google Cloud Storage?

(Asked by: username_0 on 2015-02-07)

I've been clattering around the google developers console for a while, and i just can't get it to work with Craft! I figured it'd be simple (and it may well be!) considering in Craft it just asks for two bits of data, "Access Key ID" and "Secret Access Key".

After an age of digging about in the google developes console site and a bit of searching, i ended up in the Project Dashboard for my Cloud Storage.
Enabling "Interoperable Access" gave me some new tabs on the side, one of which is "Interoperable Access", and in there FINALLY i found two strings that have the names "Access Key" and "Secret".

Putting them into Craft and hitting refresh next to Bucket gives me the error "Credentials rejected by target host".

And so now i'm stumped! Does anyone have experience using Google Cloud Storage with Craft who can point me in the right direction?

**Tags:** assets
> **Comments:**
> **username_2**: Probably best to reproduce this error and then send us a support ticket using the dashboard widget and including the log files.  
> **username_0**: Thanks Andris! Really fast and awesome support :)  For anyone else having this kind of problem... As it turns out, the initial issue was my server time not being set as Google Cloud wanted. I'm in the UK and using a server in Germany. I set it so the time synched with time1.google.com and that fixed my first issue.  Another problem popped up after that (unknown error!) but Craft support got in there and patched the issue for me so i'm good to go (and hopefully others in future wont have that problem! Sweet!)  
> **username_1**: @DanOwen Please post your solution as an answer below and accept it as the correct answer by clicking on the checkbox. You might have to wait 24hrs before you can accept it so just remember to come back to do that.  

---

## 2 answers

### Answer by username_0 on 2015-02-20. Score: 1 | Accepted answer

As it turns out, the initial issue was my server time not being set as Google Cloud wanted. I'm in the UK and using a server in Germany. I set it so the time synched with time1.google.com and that fixed my first issue.

Another problem popped up after that (unknown error!) but Craft support got in there and patched the issue for me so i'm good to go (and hopefully others in future wont have that problem! Sweet!)


---

### Answer by username_3 on 2018-09-03. Score: 4

**Craft 3:**

Once you have created your project in GC, navigate to GC Storage.

1. Create a bucket. You can only create a bucket containing the domain name if you are able to prove ownership. For example, I (personally) could not create `files.craftcms.com` as my bucket. Otherwise it can be anything you'd like. Or check out the [Bucket and Object Naming Guidelines](https://cloud.google.com/storage/docs/naming)
2. Navigate to IAM & admin. We'll need to create a Service Account that can be used to give Craft access to the bucket.
3. Give your Service account a name. For example, "Cloud Storage". Google will create a service account ID that will look something like `cloud-storage@.iam.gserviceaccount.com`. For Project Role, (you can filter) but choose "Storage Admin". You'll also want to select the checkbox labeled, "Furnish a new private key". Choose `json` as the format and click "Save".
4. A file will be downloaded to your computer - awesome. Next install the [Google Cloud Plugin for Craft](https://github.com/craftcms/google-cloud): `composer require craftcms/google-cloud`
5. Once installed, create a new Asset Resource and instead of "Local" choose "Google Cloud Storage" as a volume type.
6. Give your resource a name. For example, "Images". If you choose to have public url's use this url: `http://storage.googleapis.com/`. Unless you have a specific DNS record set up to serve images from that you want to use, you could do that too. Enter the project ID of your project. You can find that by clicking on your project name - very top (blue) nav bar. For example, it could be `my-project`
7. Finally, remember that `.json` file that was downloaded? Open that with your favorite text editor and paste the contents into "Contents of the access key file". Hit the "Refresh" button, and you should now see the name of your primary bucket. In my case `files.mysite.com`. You might also notice that Craft will update the base url to the files: `http://storage.googleapis.com/files.mysite.com/`

From there, you could create sub-folders in GCS. In my case, I've created one called images. I will update that in the Subfolder input: `images`.

Save your newly created resource!

> **Comments:**
> **username_4**: Great walkthough. I then received errors that the Cloud Storage Console API needed allowing for the project. I sorted that, then had to add credentials for it. The private_key_id proved to be the same as the one in the JSON.  
> **username_4**: And even after this, the images weren't showing publicly. This sorted it: Making groups of objects publicly readable section on https://cloud.google.com/storage/docs/access-control/making-data-public  
> **username_5**: Now that project configuration files are available, how do you add the json without having this end up in the configuration files? I'm having some issues with the authentication when I try to put it in .env, see here: https://craftcms.stackexchange.com/questions/38536/unable-to-use-credentials-json-from-env-file-for-google-cloud-storage  

---

