AWS Certified Cloud Practitioner / Other Compute Services: ECS, Lambda, Batch, Lightsail

API Gateway Overview

🧠 Core Idea

Lambda runs code without servers, but functions aren't directly accessible over the internet. If clients β€” websites, mobile apps, external users β€” need to reach your Lambda functions, something has to expose them as web APIs.

That's Amazon API Gateway: the front door to your serverless app, receiving client requests and forwarding them to backend services like Lambda.


🌐 What is API Gateway?

A fully managed service for creating, publishing, securing, and monitoring APIs. AWS handles the infrastructure β€” you focus on the application logic.


πŸ€” Why Do We Need API Gateway?

Picture a serverless app built with Lambda and DynamoDB. Lambda can process requests and read/write data β€” but users on the internet can't invoke a Lambda function directly.

Something needs to expose that function as a web endpoint. API Gateway does exactly that: it accepts requests from external clients and forwards them to the right Lambda function.


πŸ—οΈ How It Works

  1. Client sends an HTTP request

  2. API Gateway receives it

  3. Forwards it to a Lambda function

  4. Lambda processes the request, reads/writes DynamoDB if needed

  5. Response flows back through API Gateway to the client

Together, API Gateway (requests) + Lambda (logic) + DynamoDB (data) form a fully serverless app β€” no servers to provision or manage.


API Gateway is serverless itself: no infrastructure to manage, automatic scaling, built-in high availability. Traffic spikes are handled automatically.

  • REST APIs β€” standard HTTP methods (GET, POST, PUT, DELETE); used by websites, mobile/web apps, third-party integrations

  • WebSocket APIs β€” connections stay open for real-time communication; used for live chat, gaming, dashboards, notifications, streaming

  • Authentication β€” only authorized users/apps can invoke the API

  • API keys β€” identify clients, control access, track usage

  • Throttling β€” limits requests per period to prevent abuse and control costs

  • Monitoring β€” tracks traffic, request volume, performance, and errors

Whether you get a few requests a day or thousands per second, API Gateway scales automatically β€” no manual intervention needed.


🌟 Why Use API Gateway?

  • Fully managed, serverless

  • Automatic scaling

  • Easy to create and secure APIs

  • Built-in auth, API keys, throttling, monitoring

  • Native Lambda integration

πŸŽ“ Exam Tips

  • API Gateway = entry point for serverless APIs

  • Lambda functions aren't exposed directly to the internet β€” API Gateway is the front door

  • Commonly paired with Lambda and DynamoDB

  • Supports both REST and WebSocket APIs

  • Built-in: authentication, API keys, throttling, monitoring, auto-scaling

  • "Expose a Lambda function as an HTTP API" β†’ Amazon API Gateway


🧠 Key Takeaways

  • API Gateway is a fully managed service for building and securing APIs

  • It lets external clients reach Lambda functions securely

  • Serverless and auto-scaling by design

  • Supports REST and WebSocket APIs

  • Built-in authentication, API keys, throttling, and monitoring

  • Common architecture: Client β†’ API Gateway β†’ Lambda β†’ DynamoDB