- The Cloud Economist
- Posts
- Optimize API Gateway Costs with Caching, Usage Plans and Throttling
Optimize API Gateway Costs with Caching, Usage Plans and Throttling
Learn to control and reduce costs by implementing Usage Plans, setting up throttling, configuring caching, and more strategies.

Read on Beehiiv | November 10th, 2024
Welcome to The Cloud Economist!
Last week we took a look at a really valuable case study on DynamoDB.
The 3-part case study delves into how Farshidoo’s company was able to save millions on DynamoDB costs by using TTLs to delete inactive data, implementing a large-scale table scanning system to clean up massive tables efficiently, and managing read/write capacity to avoid impacting live traffic.
It is the perfect case study for anyone with a sizable DynamoDB database to learn from in order to save money and learn from their mistakes.
If you missed that edition, you can grab it here.
In the question of the week, I asked:
What are some use cases where Scanning an entire database can remain efficient and low cost?
Answer:
While Scanning should generally avoided, there are some fitting use cases where it is recommended, such as data migrations, adding TTL attributes to expire data, retrieving all email subscribers from a table, analytical queries, and cases when an admin needs to perform one-off queries.
This week we’ll discuss how to optimize costs on a widely used serverless service: API Gateway.
Here are the best articles I’ve found on cloud cost savings this week, summarized.
Article 1
6 Tips to Reduce AWS API Gateway Costs by Endgrate Team
This article discusses 6 key methods to reduce your API Gateway costs. These include:
Choosing the right API type - HTTP APIs are the cheapest (HTTP: $1/million requests, REST: $3.50/million requests)
Using caching effectively - enable caching, set TTLs and choose fitting cache sizes (e.g. 0.5GB costs $14 a month).
Setting up request throttling - set rate and burst limits to match your usage patterns.
Implementing usage plans and API keys - usage plans lets you set quotas and API keys to control who can access what, reducing abusive uses.
Reducing data transfer - save on data transfers by compressing data payloads, using CloudFront and sticking to same-region transfers whenever possible.
Tracking and reviewing API usage - regularly review API usage with CloudWatch. Adjust usage plans, TTL cache and throttling based on usage trends.
Below is a table detailing the difference between APIs, their costs, and best use cases:

Endgrate Blog
One Tip on Cloud Cost Savings
You can cut down Lambda invocations by 60% (a significant cost reduction) by setting the TTL to 300 seconds on your API Gateway config. Here’s a quick guide on enabling caching for API Gateway.
This Week’s Question
How does caching at different levels in API Gateway help reduce costs, and what metrics should you monitor to fine-tune caching settings?
Check back here next week for the answer!
Until next week.
The Cloud Economist