I know AWS Lambda can be significantly cheaper than running APIs on EC2 instances with all the required infrastructure. But what if I told you that you could make it even cheaper just by changing a few default settings?
Use arm64 instead of x86_64
AWS Lambda supports AWS Graviton processors when you select the arm64 processor architecture.
Graviton-based Lambda functions offer better price-performance compared to their x86_64 counterparts. According to AWS, they can deliver up to 34% better price-performance, thanks to both lower compute costs and improved performance.
This means you can potentially reduce your Lambda bill simply by changing the processor architecture.
Before switching, make sure your dependencies, Lambda layers, extensions, and container images are compatible with ARM64.
Example
MyFunction:
Type: AWS::Serverless::Function
Properties:
Architectures:
- arm64 # arm64 | x86_64
Runtime: nodejs22.x
Handler: app.handler
Use HTTP APIs instead of REST APIs (when possible)
Check whether you really need a REST API or whether you simply selected that option by default.
Amazon API Gateway REST APIs are more expensive than HTTP APIs. In fact, HTTP APIs can be up to 71% cheaper!
If you don't need features such as API keys, usage plans, response caching, request validation, or AWS WAF integration, consider using HTTP APIs instead.
HTTP APIs are designed to provide the essential functionality needed by most serverless applications, with lower costs and reduced latency.
The takeaway: Don't pay for features you don't need!
ILLUSTRATIVE API GATEWAY PRICING — US EAST (N. VIRGINIA)
API type | Price per million requests |
|---|
REST API | $3.50 |
HTTP API | $1.00 |
**The takeaway:** Don't pay for features you don't need!
Loading article