- The Cloud Economist
- Posts
- Optimizing Cost For AWS Lambda & Amazon SQS
Optimizing Cost For AWS Lambda & Amazon SQS
Saving money on serverless workloads by optimizing these commonly used services.

Read on Beehiiv | September 15 2024
Welcome to The Cloud Economist!
Last week I shared a few curated articles on saving money on your DynamoDB monthly costs.
I shared some typical as well as many more involve cost-optimization tips on saving considerably in DynamoDB. Techniques such as using TTLs to making use of infrequently used table classes, help with deeper and more significant cost-savings.
If you missed that you can read it here.
In the question of the week, I asked how you can optimize the cost and latency of your queries by only getting the data you need and nothing more?
The answer is using Projection Expressions. Projection Expressions let you get back only the attributes that you need in your queries. In the long term and at scale, unused data will end up costing you high. Here’s an article I wrote that goes in-depth on Projection Expressions.
This week let’s learn how to optimize costs on serverless workloads in the cloud, specifically when using AWS Lambda and Amazon SQS - two of the most used and popular serverless cloud services.
Here are the best articles I’ve found on cloud cost savings this week, summarized.
The Best Ways To Save Money On AWS Lambda by Yan Cui
Yan shares some valuable, high impact strategies to save money in Lambda: Focus on right-sizing memory allocation, especially for high-invocation or long-running functions, consider using ARM architecture for cheaper execution costs.
Additionally, while provisioned concurrency can reduce costs for high-throughput functions, it requires careful management to avoid steep penalties, and is best used to eliminate cold starts rather than as a primary cost-saving measure.
The most effective tools/strategies are:
Lambda Power Tuning Tool
Use Lambda’s ARM architecture (instead of X64)
Avoid premature optimization
Use provisioned concurrency when knowing your usage patterns
Reducing SQS Costs: Strategies and Pricing Insights by Shanika Kotgire
In this article, Shanika shares several tips to optimize your Amazon SQS message queues for costs.
Here are 7 actionable things you can use right now:
Implement long-polling - reduces unnecessary API requests
Use batch operations to combine multiple message actions into one request
Scale down consumers based on traffic
Remove unused message queues
Choose the right queue type based on application needs to balance performance and costs.
Configure dead-letter queues - extend retention periods for failed messages to avoid costly retransmissions
Use message deduplication to reduce redundant processing costs
You can read the article for a deeper dive on implementation details.
One Tip on Cloud Cost Savings
Save money on Amazon SQS by batching mssages. Instead of sending and processing one message at a time, you can send messages in batches of up to 10 messages (or up to 256 KB). This reduces the number of API requests made, which in turn lowers the cost significantly, especially for high-throughput applications.
This Week’s Question
What is one way to save costs with Amazon SQS that doesn’t require any tradeoffs on performance?
Stay tuned for the answer in next week’s edition.
Until next week.
The Cloud Economist