API Gateway: Kong, Apigee, AWS API Gateway, Rate Limiting, Auth และ API Security

API Gateway: Kong, Apigee, AWS API Gateway, Rate Limiting, Auth และ API Security

API Gateway เป็น single entry point สำหรับ API traffic ทั้งหมด Kong เป็น open-source API gateway ที่ popular ที่สุด, Apigee (Google Cloud) เป็น enterprise API management platform, AWS API Gateway เป็น serverless API management, Rate Limiting ป้องกัน API abuse และ overload, Auth จัดการ authentication/authorization สำหรับ APIs และ API Security ป้องกัน OWASP API Top 10 threats

Modern applications expose หลายร้อย APIs สำหรับ mobile apps, web apps, partners, third-party integrations — ถ้าไม่มี API gateway: แต่ละ API ต้อง implement auth, rate limiting, logging เอง (code duplication), ไม่มี centralized visibility, ไม่มี consistent security policy API gateway centralizes cross-cutting concerns ทำให้ API development เร็วขึ้นและปลอดภัยขึ้น

API Gateway Functions

Function What Why
Request Routing Route requests ไป correct backend service ตาม path/header Single entry point สำหรับทุก APIs
Authentication Verify identity (API key, OAuth2, JWT, mTLS) Centralized auth — backends ไม่ต้อง implement เอง
Rate Limiting Limit requests per client/API/time window ป้องกัน abuse, DDoS, fair usage
Load Balancing Distribute requests across backend instances HA + scale
Caching Cache API responses → reduce backend load Performance + cost savings
Request/Response Transform Modify headers, body, status codes Adapt APIs without changing backend code
Logging/Monitoring Log every request → metrics, analytics, audit Visibility, troubleshooting, compliance
Circuit Breaking Stop sending requests to failing backend Prevent cascade failures

Kong

Feature รายละเอียด
คืออะไร Open-source API gateway built on Nginx/OpenResty — most popular OSS gateway
Architecture Nginx core + Lua plugins + PostgreSQL/Cassandra datastore
Plugins 100+ plugins: auth (JWT, OAuth2, basic, key-auth), rate limiting, logging, CORS
Kong Gateway OSS Free, open-source (community edition)
Kong Enterprise Paid: developer portal, RBAC, advanced analytics, Vitals, enterprise support
Kong Ingress Controller Kubernetes-native: Kong as K8s ingress controller
Performance Sub-millisecond latency, handles millions of requests/sec
DB-less Mode Declarative config (YAML) — no database needed (GitOps-friendly)

Apigee (Google Cloud)

Feature รายละเอียด
คืออะไร Enterprise API management platform (Google Cloud) — full lifecycle API management
API Proxy Proxy layer ที่ intercept API traffic → apply policies
Developer Portal Self-service portal สำหรับ API consumers (documentation, API keys, sandbox)
Analytics Deep API analytics: latency, errors, traffic patterns, developer activity
Monetization API monetization: rate plans, billing, revenue sharing
API Products Bundle APIs เป็น products → manage access per product
Apigee X Cloud-native version on Google Cloud infrastructure

AWS API Gateway

Feature รายละเอียด
คืออะไร Serverless API management service — pay-per-request, fully managed
REST API Full-featured REST API management (caching, throttling, auth, WAF)
HTTP API Simplified, lower-cost API proxy (basic routing, auth — up to 71% cheaper)
WebSocket API Real-time bidirectional communication (chat, notifications)
Integration Lambda, ECS, EC2, any HTTP endpoint, AWS services (SQS, Step Functions)
Auth Cognito, Lambda authorizer, IAM, API keys
Pricing $3.50 per million requests (REST) / $1.00 per million (HTTP API)

Rate Limiting Strategies

Algorithm How Pros/Cons
Fixed Window Count requests per time window (e.g., 100 req/min) Simple but burst at window boundary (double rate)
Sliding Window Moving window ที่ smooth ออก boundary bursts Better than fixed but more complex
Token Bucket Tokens added at fixed rate, each request consumes token Allows bursts (up to bucket capacity) + steady rate
Leaky Bucket Requests queued → processed at fixed rate (excess dropped) Smooth output but no burst allowed
Sliding Window Log Log each request timestamp → count in window Accurate but memory-intensive

API Authentication Methods

Method Security Use Case
API Key ต่ำ (key in header/query — easy to leak) Public APIs, metering, basic identification
OAuth 2.0 สูง (token-based, scoped, expiring) Third-party access, user-delegated authorization
JWT (JSON Web Token) สูง (self-contained, signed, verifiable) Microservices, stateless auth, SSO
mTLS สูงสุด (mutual certificate authentication) Service-to-service, B2B APIs, zero trust
Basic Auth ต่ำ (base64 encoded — not encrypted) Internal/testing only (always over HTTPS)

OWASP API Security Top 10

Risk Description Mitigation
Broken Object Level Auth Access other users’ data by changing ID Validate object ownership per request
Broken Authentication Weak auth mechanisms → account takeover Strong auth (OAuth2, MFA), rate limit login
Broken Object Property Auth Mass assignment — update fields you shouldn’t Whitelist allowed fields, validate input
Unrestricted Resource Consumption No rate limiting → DoS Rate limiting, pagination, query complexity limits
Broken Function Level Auth Access admin functions as normal user RBAC, verify permissions per endpoint
Server Side Request Forgery API fetches attacker-controlled URLs Validate/whitelist URLs, block internal IPs

ทิ้งท้าย: API Gateway = Central Nervous System of APIs

API Gateway Functions: routing, auth, rate limiting, load balancing, caching, logging, circuit breaking Kong: open-source (Nginx + Lua), 100+ plugins, K8s ingress, sub-ms latency, DB-less mode Apigee: enterprise API management (Google Cloud), developer portal, analytics, monetization AWS API Gateway: serverless, pay-per-request, Lambda integration, REST/HTTP/WebSocket Rate Limiting: token bucket (best — allows bursts), sliding window, fixed window Auth: API key (basic), OAuth2 (standard), JWT (stateless), mTLS (strongest) Security: OWASP API Top 10 — object auth, function auth, rate limiting, input validation Key: API gateway centralizes cross-cutting concerns → faster development, consistent security

อ่านเพิ่มเติมเกี่ยวกับ Service Mesh Istio Envoy Linkerd และ Load Balancing L4 vs L7 HAProxy Nginx ที่ siamlancard.com หรือจาก icafeforex.com และ siam2r.com

จัดส่งรวดเร็วส่งด่วนทั่วประเทศ
รับประกันสินค้าเคลมง่าย มีใบรับประกัน
ผ่อนชำระได้บัตรเครดิต 0% สูงสุด 10 เดือน
สะสมแต้ม รับส่วนลดส่วนลดและคะแนนสะสม

© 2026 SiamLancard — จำหน่ายการ์ดแลน อุปกรณ์ Server และเครื่องพิมพ์ใบเสร็จ

SiamLancard
Logo
Free Forex EA Download — XM Signal · EA Forex ฟรี
iCafeForex.com - สอนเทรด Forex | SiamCafe.net
Shopping cart