In our ongoing series exploring the intricacies of cloud costs, we delve deeper into the nuances of serverless computing. While many are drawn to serverless due to its promise of scalability and seemingly straightforward computational costs, there’s more beneath the surface. As highlighted in our main article, focusing solely on computational costs can be misleading. The free tier might lull you into a false sense of security. Even using an online cost estimation tool—and our own tool isn’t exempt from this—can lead to a significant underestimation of the actual expenses. This could result in an unexpected shock when the first real invoice arrives. Today, in the second installment of our series, “Hidden Costs in the Serverless Cloud”, we will uncover the frequently overlooked yet substantial costs associated with data transfer and bandwidth.
Data Transfer and Bandwidth: Ingress might be free, but egress, especially cross-region or to the internet, can make costs surge. For instance, if your function serves data-rich content, like videos or high-resolution images, the egress data charges might stack up.
Say your startup provides services for online clothing stores that lets customers virtually try on their chosen outfits by uploading an image of themselves. For generating the image we have an AWS Lambda function.
Say each customer “tries on” an estimated 20 outfits and each generated image might be around 2MB in size. Our startup has their first deal with a successful online store with 10,000 daily customers.
Obviously the developers have optimized the image processing and it takes mere 750ms and 1GB of memory (image processing uses lots of memory). So we’re at 200,000 (executions) x 0.75 (seconds) x 1 (GB) = 150,000 GB-seconds and the total cost for the computation in AWS is:
150,000 x $0.00001667 = $2.50
Now we also factor in the cost per request. For AWS Lambda Request price for the first 1 million requests is $0.20.
So, 200,000 requests would cost:
(200,000 / 1,000,000) * $0.20 = $0.04
And our cost calculator will tell us we’re at a total of $2.54 daily or about $75-$80 a month. Computational costs are the main cost drivers, right? So our startup did their due diligence and can price their service accordingly at $500/month for this customer to make some sweet revenue.
So, for 10,000 customers we have 200,000 images x 2 MB = 400,000 MB of data generated and transferred daily. Over a month, that’s roughly 12 TB of egress data. For AWS Lambda the same data transfer prices apply that are detailed on the EC2-pricing page. As of November 1st 2023 it’s $0.09/GB for the first 10 TB in Region US East (Ohio).
So if you’re charged $0.09/GB for data egress, your monthly cost for this operation would be $1,080, just for data transfer. That’s a tad more than our cost estimation tool spits out for this scenario.
As our exploration into serverless costs has revealed, the true expenses extend well beyond just computational factors. When considering a serverless architecture, businesses need to be vigilant about all potential costs, especially those that can quickly accumulate, like data transfer fees. It’s essential to approach cost estimation holistically, taking into account every aspect of the serverless ecosystem. Only then can one truly grasp the financial implications and make informed decisions for their enterprise. Stay tuned as we continue to unravel more hidden costs in the world of serverless computing in upcoming articles.