Google Cloud Functions charges based on the number of function invocations. Suppose you have a function that is triggered 1,000,000 times in a month. The first 2 million invocations are free each month. How much will you be charged for invocations?
Remember the free tier covers the first 2 million invocations per month.
Google Cloud Functions offers 2 million free invocations per month. Since 1,000,000 is less than 2 million, no charges apply for invocations.
You deploy a Cloud Function with 256 MB memory and it runs for 2 seconds per invocation. You then change the memory to 512 MB but the function runtime stays the same. How does this affect your billing?
Billing depends on memory size and execution time together.
Cloud Functions billing is based on the amount of memory allocated multiplied by the execution time. Doubling memory while keeping runtime the same doubles the cost.
You have a Cloud Function that performs CPU-intensive tasks and runs for 5 seconds with 256 MB memory. You want to reduce cost and improve performance. Which approach is best?
More memory means more CPU power in Cloud Functions.
Increasing memory increases CPU allocation, which can reduce runtime. Even if memory cost is higher, shorter runtime can lower total cost.
You want to secure a Cloud Function that processes sensitive data. You add logging for every invocation, which increases execution time by 1 second. How does this affect your Cloud Functions pricing?
Execution time includes all code running inside the function.
Cloud Functions billing counts total execution time. Adding logging increases runtime, so cost increases.
You deploy identical Cloud Functions in two different regions: Region A charges $0.0000025 per GB-second and Region B charges $0.0000030 per GB-second. Both have the same free tier. You expect 10 million GB-seconds usage monthly. Which region is more cost-effective and why?
Compare price per GB-second after free tier.
Region A charges less per GB-second, so for 10 million GB-seconds usage, it costs less than Region B.