AWS Lambda Pricing vs Google Cloud Functions Pricing, Explained
Today, we are going to discuss something that is quite complex to grasp.
We're attempting to understand the price differences between Google Cloud Functions and AWS Lambda.
This can be challenging because, as you'll see on the screen with the AWS Pricing Calculator, the pricing model isn't always straightforward in terms of what you are being charged for. We are going to select a service, which will be Lambda, of course.
Click 'Configure' here. We will keep the current region and choose the Lambda function, including the free tier.
Now, the architecture we'll use is the one we currently have here, and we plan to handle 10 million requests per month. Each request will have a duration of 200 milliseconds.
Here's an important point: AWS calculates the execution time in milliseconds. In contrast, Google Cloud rounds every execution to the nearest 100 milliseconds. This means anything between 201 to 300 milliseconds in Google Cloud is always charged at the rate for 300 milliseconds.
Next, let's discuss memory allocation—another distinction. In Google Cloud, we must account for both memory and CPU usage; in AWS, we only need to consider memory. We will select 1024 megabytes, or one gigabyte.
Now, concerning ephemeral storage, there's a difference in Google Cloud. Here, everything up to 512 megabytes is free. Beyond that, the charge, in this example, is $28 of $47.
So, is this the final price we pay? Not exactly, because there are many other factors to consider.
For instance, the API Gateway's cost depends on the type of setup we use. Normally, you'd need to employ an API Gateway.
And, in another price calculator I found online, when considering serverless costs with 10 million HTTP requests, each lasting an average of 200 milliseconds and an outbound data size of 25 kilobytes—which is substantial—we might see similar costs to the Lambda one gigabyte setup previously discussed.
In Google Cloud, if we select the 'Second Generation' cloud function and input 10 million requests with an execution time of 200 milliseconds, clicking on 'Advanced' settings, then adjusting to one gigabyte as before, you'll see the prices are quite comparable—$80 versus approximately $91.
The biggest difference arises if you require a 201 millisecond execution time. In this scenario, Google Cloud rounds up to 300 milliseconds. Without any outbound data, the cost here is $111, while in another scenario for 201 milliseconds, the cost is $28. This discrepancy is significant for precise billing in AWS.
If we switch to the first generation in Google Cloud, and assume the same parameters—one gigabyte and 300 milliseconds—the price is $52 compared to $45 in AWS.
Using these calculators simplifies understanding the advertised prices, but to truly grasp the actual costs, creating a proof of concept is essential. This allows you to see the real-world implications of these services.
Here's the same article in video form for your convenience: