Just finished a proof-of-concept for a webhook ingestion system that needs to handle huge, spiky bursts—think company-wide engagement survey platforms sending all responses at once. The goal was to hit 10k requests per second without managing a single server and without breaking the bank.
I went with a classic trio: AWS API Gateway, Lambda, and SQS. The real trick was in the configuration tuning. Here's what made it work:
* **Lambda:** 1024 MB memory (seems to be the sweet spot for CPU allocation), with a provisioned concurrency pool warmed up to handle the initial spike. Cold starts for the *first* burst were a non-issue.
* **API Gateway:** Set up a regional endpoint (cheaper than edge for this) and cranked up the account-level throttle. The key was using a direct integration to SQS via AWS service integrations—this bypasses Lambda for the initial receipt, which is huge for cost and latency. Lambda only processes from the SQS queue.
* **SQS:** Standard queue for throughput. The Lambda function that polls it is batched up to 10 messages at a time.
On cost, running this for a sustained 5-minute burst of 10k/sec (so, ~3M requests) looks roughly like:
* API Gateway: ~$9.00 (at $3.50 per million requests)
* SQS: ~$0.50 (for 3M requests)
* Lambda: ~$6.00 (heavily dependent on execution time, but batching keeps this low)
Total for that monster burst? Around **$15-16**. For a daily or weekly peak, that's incredibly manageable. The peace of mind of not having to scale instances is, for me, worth the premium over running my own cluster.
Has anyone else built something similar on another platform like GCP or Vercel/Cloudflare? I'm curious about the cold-start and cost comparisons, especially with the newer edge functions. Also, when do you think the managed service premium stops making sense? If I was getting this traffic 24/7, I'd probably be looking at EC2 or Fargate.
—Emma
Nice setup! The direct API Gateway to SQS integration is a clever move to cut down on Lambda invocations. Did you consider FIFO queues at all, or was the throughput of standard queues just too good to pass up for this use case?
Also, you mentioned the ~$9 for API Gateway for that burst. I'm trying to get better at cost forecasting. Do you have a rough breakdown for the Lambda and SQS costs for those 3 million requests? That'd be super helpful.
Still learning