
Serverless Functions
How am I billed for Serverless Functions?
Principle
Serverless Functions is billed on a pay-as-you-go basis. Three components are taken into account:
-
Monthly Request number: each time your function is invoked we increase a counter.
-
Resource consumption: this component is obtained by multiplying the memory tiers chosen (128 MB, 256 MB, 512 MB, 1024 MB, 2048 MB) by the duration of each function invocation.
-
Resources provision: in order to mitigate cold start, users can choose to keep some function Instances warm (by filing the min scale value). We then charge for the provisioned resources similarly to the Resources consumption component.
The scheme below illustrates our billing model:
Pricing
-
Monthly requests: €0.15 per million requests and we offer 1M free requests per account per month.
-
Resources consumption: €1.20 per 100k GB/s and we provide 400 000 GB/s free tiers per account and per month.
Memory provisioned | Cost per second |
---|---|
128 MB | €0.0000015 |
256 MB | €0.0000030 |
512 MB | €0.0000060 |
1024 MB | €0.0000120 |
2048 MB | €0.0000240 |
3072 MB | €0.0000360 |
4096 MB | €0.0000480 |
- Resources provision: €0.36 per 100k GB/s
Memory provisioned | Cost per second |
---|---|
128 MB | €0.00000045 |
256 MB | €0.0000009 |
512 MB | €0.0000018 |
1024 MB | €0.0000036 |
2048 MB | €0.0000072 |
3072 MB | €0.0000108 |
4096 MB | €0.0000144 |
Examples
Example 1: Without resources provisioning
Criteria | Value |
---|---|
Number of requests | 30 000 000 |
Average request duration | 1 s |
Allocated resources (memory) | 128 MB |
Free tier | Yes |
Provision/minimum instances | 0 |
-
Resources consumption
- Service usage duration: 30 000 000 Requests x 1 s = 30 000 000 seconds used
- Memory conversion: 128 MB = 0.125 GB
- Resources consumed: 30 000 000 s x 0.125 GB = 3 750 000 GB/s
- Free tier: 400 000 GB/s
- Resourced billed: 3 750 000 - 400 000 = 3 350 000 GB/s
- Cost: 3 350 000 x €0.0000120 = €40.20
-
Requests:
- Free tier: 1 000 000 requests
- Billed requests: 30 000 000 - 1 000 000 = 29 000 000 Requests
- Cost: 29 000 000 x €0.00000015 = €4.35
Total monthly cost: €44.55
Example 2: With resources provisioning
Criteria | Value |
---|---|
Number of requests | 30 000 000 |
Average request duration | 1 s |
Allocated resources (memory) | 128 MB |
Free tier | Yes |
Provision/minimum instances | 1 |
-
Resources consumption
- Service usage duration: 30 000 000 Requests x 1 s = 30 000 000 seconds used
- Memory conversion: 128 MB = 0.125 GB
- Resources consumed: 30 000 000 s x 0.125 GB = 3 750 000 GB/s
- Free tier: 400 000 GB/s
- Resourced billed: 3 750 000 - 400 000 = 3 350 000 GB/s
- Cost: 3 350 000 x €0.0000120 = €40.20
-
Provisioned functions consumption:
- Provisioned duration: 1 month = 2 592 000 seconds, with one minimum instance → 2 592 000 seconds used
- Provisioned resources consumed: 2 592 000 x 0.125 GB = 324 000 GB/s
- Cost: 324 000 x €0.0000036 = €1.17
-
Requests:
- Free tier: 1 000 000 requests
- Billed requests: 30 000 000 - 1 000 000 = 29 000 000 Requests
- Cost: 29 000 000 x €0.00000015 = €4.35
Total monthly cost: €45.72
What are the limitations of Serverless Functions?
Refer to our dedicated page about Serverless Functions limitations and configuration restrictions for more information.
What runtimes are available on Serverless Functions?
Serverless Functions enables you to deploy functions using popular languages: Go
, Node
, Python
, PHP
, Rust
…
Refer to our dedicated page about Serverless Functions Runtimes Lifecycle
How can I check build errors?
Some Serverless runtimes (ex: Go
, Rust
) will compile your code in order to make your function executable.
Compilation can fail if errors are present in the code, for example syntax errors and missing libraries.
Build errors are sent to the Observability platform on Scaleway Cockpit. You need to activate your Cockpit to read build logs.
In the Serverless Functions Logs
dashboard, you will then be able to read information about your log build outputs, if errors occurred during compilation.
Can I allow to list the IPs of my functions?
Some services need to filter IPs, for example databases. Serverless Functions does not support Virtual Private Networks yet but you can use the Scaleway IP ranges defined in the following link: http://as12876.net/.
How can I deploy my Functions?
Serverless Functions use cases are wide so several ways to deploy functions are available.
How can I test my functions locally?
Local development is useful for debugging, profiling, testing etc… so we provide libraries to do this: local testing doc.
Where can I find some advanced code examples for functions?
Check out our serverless-examples repository for real world projects.
How to migrate runtimes?
There are no constraints when changing a function runtime, you simply need to choose the runtime version you want. Upgrading a runtime is highly recommended in case of deprecation, and for runtimes that have reached end-of-support or end-of-life. See the functions runtimes lifecycle documentation for more information.