Search code examples
google-cloud-platformgoogle-cloud-cdngcp-load-balancer

GCP - can we create service account for Load Balancer / CDN?


I have a Storage Bucket in GCP with a bunch of html files and images (just for testing purposes). Let's call this my-bucket.

I would like this to expose this via Cloud CDN. I was able to create a Cloud CDN for the bucket.

Cloud CDN also created a Load Balancer.

If I try to access the load balancer IP, I get this error.

<Error>
<Code>AccessDenied</Code>
<Message>Access denied.</Message>
</Error>

Should I be providing public read access to the bucket? How can I attach a service account to a LB for a better access?


Solution

  • If your bucket was set as publicly accessible, you can assign your cloud storage as the backend of your load balancer. This way, your bucket will be accessible via the load balancer IP address. This is possible as stated in this documentation.