Projects

This page describes the relationship between Google Cloud Console projects and Cloud Storage resources. To learn more about Google Cloud Console projects in general, read Projects in the Overview of Google Cloud.

What is a project?

A project organizes all your Google Cloud resources. A project consists of a set of users; a set of APIs; and billing, authentication, and monitoring settings for those APIs. So, for example, all of your Cloud Storage buckets and objects, along with user permissions for accessing them, reside in a project. You can have one project, or you can create multiple projects and use them to organize your Google Cloud resources, including your Cloud Storage data, into logical groups.

When to specify a project

Most of the time, you do not need to specify a project when performing actions in Cloud Storage; however you should include either the project ID or the project number in the following cases:

Console

  • When using Cloud Storage with the Cloud Console, you're automatically associated with a project. You can change projects by using the drop-down menu at the top of the Cloud Console window.

  • When first accessing a bucket that has enabled Requester Pays, you're prompted to select a project to bill requests to. You can subsequently change the billing project by using the Change project button located above the list of objects in the bucket.

gsutil

  • The gsutil mb, gsutil ls, and gsutil kms commands require you to specify a project, unless you have set a default project. If you have not set a default project, or if you would like to use a different project, use the -p flag to specify a project. No other gsutil commands require you to specify a project.

  • Use the -u flag, along with a project ID, to indicate the project to charge for bucket access. This is required when accessing a bucket that has enabled Requester Pays and is optional otherwise.

JSON API

  • The list buckets and insert bucket methods require you to specify a project. The project is sent as a parameter in the request URL, as in the following example:

    GET https://storage.googleapis.com/storage/v1/b?project=[PROJECT_ID]
  • To indicate a project to charge for bucket access, use the 'userProject' query paratemer, along with a project ID, as in the following example:

    GET https://storage.googleapis.com/storage/v1/b?userProject=[PROJECT_ID]

    This query parameter is required when accessing a bucket that has enabled Requester Pays and is optional otherwise.

XML API

  • Specify a project when listing buckets and inserting buckets. The project associated with these XML API requests is specified in the x-goog-project-id HTTP header, as in the following example:

    x-goog-project-id: [PROJECT_ID]

    The header is optional for other XML API requests or if you have set a default project for interoperable access.

  • To indicate a project to charge for bucket access, use the 'x-goog-user-project' header, along with a project ID, as in the following example:

    x-goog-user-project: [PROJECT_ID]

    This header is required when accessing a bucket that has enabled Requester Pays and is optional otherwise.

Projects and permissions

For each project, you use Cloud Identity and Access Management to grant the ability to manage and work on your project. When you grant a Cloud IAM role to a member, such as a Google Account, that member obtains certain permissions that allow them to perform actions. When you grant a role at the project level, the access provided by the role applies to every bucket and object within the project. Alternatively, when you grant a role for an individual bucket, the access provided by the role is limited to just that bucket and the objects the bucket contains.

For a list of available roles that apply to Cloud Storage, as well as a discussion about how a special set of roles, called primitive roles, apply to Cloud Storage, see Cloud Storage IAM roles.

For instructions for viewing, granting, and revoking a member's roles at the bucket and project level, see Using IAM with projects.

Service Accounts

Service accounts allow applications to authenticate and access Google Cloud resources and services. For example, you can create a service account that your Compute Engine instances use to access objects stored in Cloud Storage buckets.

Service accounts are created within a project and have a unique email address that identifies them. While most service accounts are created and managed by a user, some service accounts are automatically created and managed by Google Cloud services. Cloud Storage creates one such service account with an email address that has the following format:

service-[PROJECT_NUMBER]@gs-project-accounts.iam.gserviceaccount.com

Where [PROJECT_NUMBER] is the project number of the project that owns the service account.

Uses with Cloud Storage

The following features use Cloud Storage service accounts:

Examples of actions that non-Cloud Storage service accounts can take which use Cloud Storage resources:

What's next?