To give a service account access to a Google Cloud Storage bucket, add the account as an IAM principal on that bucket and assign only the role it requires. For downloads, use Storage Object Viewer. Choose Storage Object Creator for upload-only workloads, or Storage Object Admin if the application needs to manage objects.
Granting IAM access at the bucket level is usually safer than assigning a storage role across the project. It limits the service account to one bucket rather than every bucket in the project.

Choose the right Cloud Storage IAM role
| Required access | Recommended role | What it allows |
|---|---|---|
| Download and list objects | roles/storage.objectViewer | Read object data and metadata |
| Upload new objects only | roles/storage.objectCreator | Create objects without reading, replacing, or deleting existing objects |
| Read, upload, replace, and delete objects | roles/storage.objectAdmin | Full management of objects within the bucket |
| Manage bucket configuration and IAM | roles/storage.admin | Administrative bucket and storage control |
Don’t give a normal application roles/storage.admin unless it truly needs to create buckets, change retention settings, or manage IAM policies. One of the object-level roles is enough for most workloads.
Before you begin
- You need permission to update the bucket’s IAM policy. This commonly requires
roles/storage.adminor an equivalent set of permissions. - Have the bucket name ready, such as
my-app-uploads. - You’ll also need the full service account email address, such as
app-worker@my-project.iam.gserviceaccount.com. - If you’re using the command line, install and authenticate the Google Cloud CLI.
Grant access in the Google Cloud Console
- Open the Google Cloud Console, go to Cloud Storage, and then select Buckets.
- Choose the bucket the application needs to access.
- Open the Permissions tab.
- Select Grant access.
- Enter the service account email address in New principals.
- Under Assign roles, search for the appropriate Cloud Storage role and select it, such as Storage Object Viewer.
- Select Save.
The new permission usually takes effect quickly, though a short propagation delay can occur. If the workload still returns an access denied error, make sure it’s running as the same service account you added to the bucket.
Grant access with the gcloud CLI
This command gives a service account read-only access to objects at the bucket level:
gcloud storage buckets add-iam-policy-binding gs://BUCKET_NAME \
--member="serviceAccount:SERVICE_ACCOUNT_EMAIL" \
--role="roles/storage.objectViewer"Replace the placeholders with the correct values:
gcloud storage buckets add-iam-policy-binding gs://my-app-uploads \
--member="serviceAccount:app-worker@my-project.iam.gserviceaccount.com" \
--role="roles/storage.objectViewer"For an upload-only process, assign the Object Creator role instead:
gcloud storage buckets add-iam-policy-binding gs://my-app-uploads \
--member="serviceAccount:app-worker@my-project.iam.gserviceaccount.com" \
--role="roles/storage.objectCreator"A backup process that must upload, replace, and delete files needs Object Admin:
gcloud storage buckets add-iam-policy-binding gs://my-app-uploads \
--member="serviceAccount:backup-worker@my-project.iam.gserviceaccount.com" \
--role="roles/storage.objectAdmin"Verify the bucket IAM policy
List the bucket’s IAM policy, then check that the service account appears under the intended role:
gcloud storage buckets get-iam-policy gs://my-app-uploadsYou can also test access while authenticated as the service account. For Google Cloud services such as Compute Engine, Cloud Run, Cloud Functions, and GKE, attach the service account to the workload rather than downloading a key file.
For example, an application built with Google Cloud client libraries can generally use Application Default Credentials automatically once its runtime service account has permission to access the bucket.
Common mistakes with Cloud Storage permissions
Assigning the role at the project level
A project-level role may unintentionally let the service account access other buckets in the same project. If the workload needs only one bucket, assign the role directly on that bucket.
Using the wrong service account email
A Google Cloud project can have several service accounts, including default Compute Engine and Cloud Run identities. Before changing IAM, confirm which identity the actual workload is configured to use.
Expecting Object Creator to overwrite files
roles/storage.objectCreator can create new objects, but it can’t read, delete, or overwrite existing ones. Use Object Admin only when the application needs those extra actions.
Confusing bucket access with signed URL access
A signed URL provides temporary access to a single object or operation. Bucket IAM roles, by contrast, provide ongoing access to a principal. Signed URLs are a better fit when external users need limited, short-lived access without being added as IAM principals.
Creating service account keys unnecessarily
Long-lived JSON keys can be copied or leaked, and rotating them can be difficult. For workloads running on Google Cloud, attach a service account directly to the resource. If the system is external, consider Workload Identity Federation before creating a key.
Remove bucket access when it’s no longer needed
To delete an unused role binding, use the same member and role values:
gcloud storage buckets remove-iam-policy-binding gs://my-app-uploads \
--member="serviceAccount:app-worker@my-project.iam.gserviceaccount.com" \
--role="roles/storage.objectViewer"Review bucket IAM policies regularly, particularly for production buckets that hold backups, customer uploads, exports, or sensitive data. Narrowly scoped roles reduce the potential impact if a workload identity is compromised.
FAQ
What is the minimum role for downloading files from a GCS bucket?
Use roles/storage.objectViewer. It lets the service account read object data and metadata without modifying objects or changing bucket settings.
Can I give a service account access to only one Google Cloud Storage bucket?
Yes. Add the service account to the bucket’s IAM policy, either through the Console or with gcloud storage buckets add-iam-policy-binding. This is preferable to assigning a broad storage role at the project level.
Does a service account need a JSON key to access Cloud Storage?
No. Workloads on Google Cloud should generally use an attached service account with Application Default Credentials. JSON keys are mainly a legacy option and should be avoided when an attached identity or federation method is available.





