api-gateway-backend-security-and-rate-limiting
Qué hace
Esta skill ayuda a un agente de IA a asegurar una API que se ejecuta detrás de API Gateway de Google Cloud. Es para desarrolladores que quieren controlar quién puede llamar a su API y con qué frecuencia.
Cuándo usarla
- ✓Cuando quieres exigir claves de API o tokens de inicio de sesión antes de que alguien pueda llamar a tu API en Google Cloud.
- ✓Cuando necesitas proteger un backend de Cloud Run para que solo la pasarela de API pueda acceder a él.
- ✓Cuando quieres establecer límites de peticiones por proyecto para un servicio de API Gateway.
Link de la skill
https://github.com/google/skills/blob/main/skills/cloud/api-gateway-backend-security-and-rate-limiting/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“Protege mi API en Google Cloud para que solo la puedan llamar usuarios con sesión iniciada y con una clave válida, y limita cuántas peticiones pueden hacer.”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
Actualiza el archivo de definición de la API para añadir comprobaciones de inicio de sesión, una cuenta de servicio de pasarela para el backend y límites por proyecto. También ejecuta comprobaciones de validación de los ajustes.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de GitHub.
API Gateway Backend Security and Rate Limiting
This skill configures client authentication, gateway-to-backend authentication, and per-project rate limits (quotas) for Google Cloud API Gateway across OpenAPI 2.0 (swagger: "2.0") and OpenAPI 3.0.x (openapi: 3.0.4), including gateways with Model Context Protocol (MCP) enabled (Public Preview).
Attribution
MUST READ: Before executing any gcloud, REST API, or MCP command, you
MUST read Usage Attribution. For commands executed
directly in the terminal (never in generated scripts, Terraform, or user code),
prefix gcloud with
CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:api-gateway-backend-security-and-rate-limiting)"
and append agent-skills/1.0 (skill:api-gateway-backend-security-and-rate-limiting) to User-Agent headers.
Prerequisites
- Install the Google Cloud CLI and Python 3.10+ YAML parser:
- Install or update the Google Cloud SDK.
- Install
PyYAMLfor the quota metric validation script:pip install "PyYAML>=6.0,<7.0"
- Authenticate your environment:
- Local CLI session:
gcloud auth login - Application Default Credentials (SDKs):
gcloud auth application-default login - Service account key file (if required by CI): set
GOOGLE_APPLICATION_CREDENTIALS={key_file_path}
- Local CLI session:
- Select or create a project, verify billing, and pick a supported gateway location:
- Select an existing project (
gcloud config set project {project_id}) or create one (gcloud projects create {project_id}as an escape hatch). - Verify that an active billing account is linked to
{project_id}(required even when staying within the API Gateway pricing free tier). - Use
us-central1as the default--locationfor API Gateway commands. For the other supported regions, see API Gateway deployment model.
- Select an existing project (
- Enable required Google Cloud APIs:
API Gateway does not need the Cloud Run API. If the backend runs on Cloud Run, that API is already enabled in the backend's project.gcloud services enable \ apigateway.googleapis.com \ servicemanagement.googleapis.com \ servicecontrol.googleapis.com \ iam.googleapis.com \ apikeys.googleapis.com \ --project={project_id} - Verify required IAM roles:
- To manage API Gateway resources and enable services:
roles/apigateway.adminandroles/serviceusage.serviceUsageAdmin - To create the gateway service account and attach it to an API config:
roles/iam.serviceAccountAdminandroles/iam.serviceAccountUser - To manage API keys in consumer projects:
roles/serviceusage.apiKeysAdmin - For the gateway service account to invoke the backend:
roles/run.invoker(Cloud Run or 2nd gen functions) orroles/cloudfunctions.invoker(1st gen functions)
- To manage API Gateway resources and enable services:
Decision Matrix: Client Authentication, Backend Security, and Quotas
Select the layer that matches the security requirement:
| Goal | Mechanism to Configure | Key Constraint | Detailed Reference |
|---|---|---|---|
| Identify the calling consumer project for quotas and billing | API key (x-api-key header convention; key query parameter escape hatch) |
NEVER rely on an API key alone to authenticate end-user identity. Rationale: API keys identify a Google Cloud project rather than a user, and clients can extract them. | Client Authentication |
| Authenticate end users or calling services | JWT (oauth2 scheme with x-google-issuer / x-google-jwks_uri in OAS 2.0, or x-google-auth in OAS 3.x) |
Operation-level security overrides root security. Include api_key: [] and the JWT scheme in the same security requirement object when an endpoint needs both user identity and quotas. |
Client Authentication |
| Block direct calls to the backend service | Dedicated gateway service account (--backend-auth-service-account) + roles/run.invoker + backend --no-allow-unauthenticated |
Roll out the gateway config with --backend-auth-service-account BEFORE setting --no-allow-unauthenticated on a live backend to avoid 403 downtime. |
Backend Security |
| Rate limit requests per consumer project (`1/mi |
Preguntas frecuentes
¿Qué formatos de archivo de API admite?
Admite archivos OpenAPI 2.0 y OpenAPI 3.0.x, incluidas las pasarelas con MCP activado.
¿Puede mi backend saber quién lo llama?
Sí. La pasarela pasa las notificaciones firmadas del usuario en una cabecera que tu backend puede leer.
¿Necesita la CLI de Google Cloud?
Sí. La CLI debe estar instalada y con sesión iniciada, y el validador necesita Python 3.10 o posterior.
Detalles
Descripción original del autor
Secures and rate limits backend services behind Google Cloud API Gateway across OpenAPI 2.0 and OpenAPI 3.0.x API configurations, including MCP-enabled gateways. Use when configuring API key or JWT authentication, locking down Cloud Run or Cloud Run functions backends with a gateway service account, reading authenticated claims from X-Apigateway-Api-Userinfo, setting per-project request quotas, or diagnosing HTTP 429 and HTTP 500 Service Control Quota errors. Do not use for Apigee, GKE Gateway API, Cloud Load Balancing custom domain setup, or LLM model routing.
repo: google/skills
Popularidad
- Estrellas en GitHub
- 22 mil
- Posición en el ranking
- #10213
- Licencia
- Apache-2.0
- Actualizada
- 2/11/2026
Comentarios
- …
Más skills de este repositorio
finding-google-skills
22 milAyuda a tu agente a encontrar las guías de Google adecuadas para una tarea de configuración, como alojamiento, bases de datos, almacenamiento, inicio de sesión o servicio de modelos de IA.
gcloud
22 milAyuda a tu agente a escribir y comprobar comandos gcloud de Google Cloud, consultando la sintaxis exacta antes de ejecutar nada para no adivinar los parámetros.
google-cloud-recipe-auth
22 milGuía a tu agente por la identidad y el acceso en Google Cloud, incluido cómo inician sesión las personas y los servicios y qué permisos reciben.
google-cloud-recipe-onboarding
22 milGuía a un desarrollador nuevo en sus primeros pasos en Google Cloud, incluida la elección de un proyecto, la vinculación de la facturación y el despliegue de un primer recurso.
Skills parecidas
reverse-engineer-anything
422 milAyuda a tu agente a revisar apps y paquetes ya publicados para explicar sus funciones, comparar versiones o guiar una reconstrucción, usando la herramienta REA.
1password
394 milAyuda a tu agente a instalar la CLI de 1Password, iniciar sesión y leer o inyectar secretos sin imprimir sus valores en el chat.
healthcheck
394 milAyuda a tu agente a auditar el ordenador o servidor que ejecuta OpenClaw en busca de riesgos de seguridad, como SSH, cortafuegos, actualizaciones y copias de seguridad, y después sugerir arreglos seguros.