Cloud Projects

Calls to the Earth Engine API, either via the Code Editor, the the Python client, or the REST API, are associated with a Cloud Project. The computations requested via the Earth Engine API will be made with compute quota, resources and permissions of the selected project. When operated in legacy mode, the calls are associated with a project owned by Earth Engine. This guide shows how to associate calls from the client APIs (JavaScript or Python) or the REST API with any Cloud project on which you have suitable permissions.

Choosing a project

The Earth Engine API must be enabled on all projects before requests will succeed. This is done automatically when you create a project in the Code Editor. You can manually enable the Earth Engine API in the Cloud console for whatever project you plan to use. You must also have sufficient permission to use the project or its assets. Specifically, you need to have the Service Usage Consumer role to route computations through a project and an Earth Engine role to access project assets. See this page for more information about setting permissions to use Earth Engine and this guide for information about setting up a Cloud Project for use with Earth Engine.

Code Editor

You can toggle the project through which the Code Editor makes calls from your login in the upper right of the Code Editor. When no project is selected here, calls are made through a project owned by Earth Engine.

Python Client

Calls from the Earth Engine Python client can be associated with a project by passing a project ID to ee.Initialize(). When using ee.ServiceAccountCredentials(), be sure that the service account is registered to use Earth Engine as described on this page and has been given project-level permissions to use the Earth Engine service as described here. For example, follow these instructions to create a service account and private key file named .private-key.json, then run:

import ee
service_account = 'my-service-account@...gserviceaccount.com'
credentials = ee.ServiceAccountCredentials(service_account, '.private-key.json')
ee.Initialize(credentials=credentials, project='my-project')

REST API

To associate calls to the REST API with a Cloud Project, issue authenticated HTTP calls where authentication is handled by oauth2. In a local environment, you can use the gcloud command. You can also use a Service Account associated with a Cloud Project. See the REST API Quickstart for an example of using google.oath.service_account.Credentials.from_service_account_file() to authenticate with a service account.

Command Line

To associate Earth Engine calls from the command line with a Cloud Project, use the --project parameter in your call to earthengine or use set_project. For example:

earthengine set_project my-project