I’m feeling a bit stuck and would really appreciate your help. I’ve set up a Google Cloud Global External Application Load Balancer with a backend bucket and enabled CDN. I also added an SSL certificate to ensure all traffic is securely routed to HTTPS.
However, when I try to access the storage files through the CDN, I keep getting an AccessDenied Error (403). I want to ensure that only the load balancer can access the bucket to fill the CDN cache, but I’m not sure how to set it up correctly.
I found two possible solutions online:
Make the Storage Bucket public: I don’t want to do this, as I want the bucket’s access restricted to just the load balancer.
Grant the load balancer’s service account access to the bucket: The problem is, I can’t find any service account related to the load balancer.
Has anyone encountered a similar issue or can offer guidance? I want to resolve this without making the bucket public or giving access to anyone else. Any advice or steps would be greatly appreciated!
To resolve the AccessDenied Error (403) without making the bucket public, you should grant access to the load balancer’s service account. Here are the steps to find and set up the service account:
Find the Load Balancer Service Account:
Go to the Google Cloud Console.
Navigate to “IAM & Admin” → “IAM”.
Look for a service account named something like service-@compute-system.iam.gserviceaccount.com.
Grant Access to the Service Account:
Go to “Cloud Storage” → “Buckets”.
Select your bucket.
Click on the “Permissions” tab.
Add the load balancer’s service account and grant it the role “Storage Object Viewer”.
This should allow the load balancer to access the bucket without making it public.
ERROR: gcloud crashed (UnicodeDecodeError): 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
If you would like to report this issue, please run the following command:
gcloud feedback
To check gcloud for common problems, please run the following command:
gcloud info --run-diagnostics
You would have to make the changes mentioned in 7c before you can reuse the config. Below is a sample complete config that you can use as a reference. Try adding the optional accessKeyVersion under awsV4Authentication in case the below doesnt work.