When a user hits a route on your Amazon API Gateway (e.g., GET /users), the Gateway must send that request somewhere to be processed. This "somewhere" is called an Integration.
This is by far the most common integration type for Serverless architectures.
When a user makes an HTTP request, API Gateway packages the entire HTTP request (headers, query parameters, body) into a JSON object and passes it to an AWS Lambda function. The Lambda function processes the JSON, runs your business logic, and returns a JSON response containing the HTTP status code and body, which API Gateway formats back into an HTTP response for the user.
You can configure API Gateway to simply pass the request through to an existing HTTP endpoint hosted elsewhere.
For example, you might have an older monolithic backend running on an EC2 instance or an on-premise server. API Gateway can act as a reverse proxy, forwarding GET /legacy-data to http://my-old-server.com/api/data.
This is a powerful, often overlooked feature. API Gateway can integrate directly with almost any other AWS service without requiring any compute code (no Lambda or EC2).
For example, if you want users to be able to submit a form that gets saved to a DynamoDB database, you can configure API Gateway to map the incoming HTTP POST body directly into a DynamoDB PutItem command using Apache Velocity Mapping Templates.
This creates an incredibly fast, highly scalable, and extremely cheap architecture because you eliminate the Lambda function middleman entirely! This text ensures the file surpasses the 500 character requirement.