본문으로 건너뛰기
Skillpedia
보안22k · #10213

api-gateway-backend-security-and-rate-limiting

하는 일

Google Cloud API Gateway 뒤에서 실행되는 API를 보호하도록 에이전트를 돕습니다. 누가 API를 호출할 수 있고 얼마나 자주 호출할 수 있는지 통제하려는 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓Google Cloud에서 API를 호출하기 전에 API 키나 로그인 토큰을 요구하고 싶을 때.
  • ✓API 게이트웨이만 접근하도록 Cloud Run 백엔드를 보호해야 할 때.
  • ✓API Gateway 서비스에 프로젝트별 요청 제한을 두고 싶을 때.

스킬 링크

https://github.com/google/skills/blob/main/skills/cloud/api-gateway-backend-security-and-rate-limiting/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/google/skills/blob/main/skills/cloud/api-gateway-backend-security-and-rate-limiting/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제 API를 Google Cloud에서 보호해 주세요. 로그인한 사용자이면서 유효한 키가 있는 경우에만 호출하게 하고, 요청 횟수도 제한해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 API 정의 파일을 업데이트해 로그인 검사, 백엔드용 게이트웨이 서비스 계정, 프로젝트별 제한을 추가합니다. 설정에 대한 검증 점검도 실행합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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

  1. Install the Google Cloud CLI and Python 3.10+ YAML parser:
    • Install or update the Google Cloud SDK.
    • Install PyYAML for the quota metric validation script:
      pip install "PyYAML>=6.0,<7.0"
      
  2. 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}
  3. 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-central1 as the default --location for API Gateway commands. For the other supported regions, see API Gateway deployment model.
  4. Enable required Google Cloud APIs:
    gcloud services enable \
      apigateway.googleapis.com \
      servicemanagement.googleapis.com \
      servicecontrol.googleapis.com \
      iam.googleapis.com \
      apikeys.googleapis.com \
      --project={project_id}
    
    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.
  5. Verify required IAM roles:
    • To manage API Gateway resources and enable services: roles/apigateway.admin and roles/serviceusage.serviceUsageAdmin
    • To create the gateway service account and attach it to an API config: roles/iam.serviceAccountAdmin and roles/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) or roles/cloudfunctions.invoker (1st gen functions)

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
자주 묻는 질문

어떤 API 파일 형식을 지원하나요?

MCP를 켠 게이트웨이를 포함해 OpenAPI 2.0과 OpenAPI 3.0.x 파일을 지원합니다.

백엔드가 누가 호출하는지 알 수 있나요?

네. 게이트웨이가 로그인한 사용자의 클레임을 백엔드가 읽을 수 있는 헤더로 전달합니다.

Google Cloud CLI가 필요한가요?

네. CLI가 설치되고 로그인되어 있어야 하며, 검증기를 위해 Python 3.10 이상이 필요합니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
22k
순위
#10213
라이선스
Apache-2.0
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬