kumowoon1025
kumowoon1025

Reputation: 211

Is it possible to use my domain for the URL for publicly available objects in a Google Cloud Storage Bucket?

I set up a Google Cloud Storage bucket with a domain I own, after going through the ownership verification step.

I was thinking I would be able to use the named bucket to provide links under my own domain. I can't really explain this clearly, so bear with me please. I'll give an example.

I uploaded a file with name test. After making it publicly available, I can get a URL so anybody can access the file. The URL looks like this:

https://storage.googleapis.com/media.example.com/test

What I thought I'd be able to do is have it generate a link that looks like this:

https://media.example.com/test

Is this possible at all? I realize I can set something up so requests to https://media.example.com/test redirect to https://storage.googleapis.com/media.example.com/test, but that's kind of messy, among other things.

Any advice would be appreciated.

Upvotes: 2

Views: 2320

Answers (1)

gerwin
gerwin

Reputation: 909

You can do this by creating a CNAME record in the domain configuration for your domain.

Simply add a CNAME record for media.example.com with c.storage.googleapis.com as the canonical name and the redirection happens automagically.

There's an entire page dedicated to doing exactly this in the GCP docs here: https://cloud.google.com/storage/docs/hosting-static-website

Upvotes: 4

Related Questions