Google Cloud App Engine Admin API
The `google-cloud-appengine-admin` client library for Python allows developers to programmatically manage their Google App Engine applications, including services, versions, instances, and certificates. It is an actively maintained, stable client, part of the larger `google-cloud-python` monorepo, receiving regular updates. The current version is 1.17.0, and it adheres to Google Cloud's client library release cadence.
Warnings
- breaking Python 2.x and older Python 3.x versions are no longer supported. The library requires Python >= 3.9.
- gotcha Authentication and authorization are critical. You must enable the App Engine Admin API in your GCP project and provide credentials with appropriate permissions (e.g., `roles/appengine.appAdmin` or `roles/owner`). Additionally, specific OAuth 2.0 scopes like `https://www.googleapis.com/auth/appengine.admin` may be required.
- deprecated The underlying Google App Engine Gen 1 runtimes (e.g., Python 2.7, Java 8) are being deprecated and will no longer be supported after January 31, 2026. While the client library may still function, deployments on these runtimes will cease, and security updates will stop.
- gotcha Google Cloud resources often use specific 'resource name' formats (e.g., `projects/PROJECT_ID/locations/LOCATION_ID/applications/APPLICATION_ID`). Ensure you construct these names correctly when making API calls that require them.
- gotcha When deploying Python applications to App Engine Standard environment, vendoring dependencies using `pip install -t lib/` can lead to dependency conflicts if not handled carefully, especially when multiple `google-cloud-` libraries share namespaces.
Install
-
pip install google-cloud-appengine-admin
Imports
- AppEngineAdminClient
from google.cloud import appengine_admin_v1
- types
from google.cloud.appengine_admin_v1 import types
Quickstart
import os
from google.cloud import appengine_admin_v1
# Ensure GOOGLE_CLOUD_PROJECT environment variable is set
# For local development, ensure GOOGLE_APPLICATION_CREDENTIALS is set
# or a service account key is available and has necessary permissions (e.g., App Engine Admin).
project_id = os.environ.get("GOOGLE_CLOUD_PROJECT", "your-gcp-project-id")
def list_app_engine_applications(project_id: str):
"""Lists all App Engine applications in the specified project."""
if project_id == "your-gcp-project-id":
print("Please set the GOOGLE_CLOUD_PROJECT environment variable or replace 'your-gcp-project-id' with your actual project ID.")
return
try:
# Create a client
client = appengine_admin_v1.AppEngineAdminClient()
# The `list_applications` method lists applications associated with the authenticated project.
applications = client.list_applications()
print(f"App Engine Applications in project '{project_id}':")
found_any = False
for app in applications:
print(f"- {app.name} (ID: {app.id}) - Auth Domain: {app.auth_domain})")
found_any = True
if not found_any:
print("No applications found or the App Engine Admin API is not enabled/permissions are insufficient.")
except Exception as e:
print(f"An error occurred: {e}")
print("Ensure the 'App Engine Admin API' is enabled in your GCP project and your credentials have sufficient permissions (e.g., App Engine Admin role).")
if __name__ == "__main__":
list_app_engine_applications(project_id)