A static site is nice, but many companies offer this service. I picked Scaleway in no small part because it was promising serverless functions. Would these be easy to set up? How would they perform? How much would they cost?
The terraform for a Scaleway serverless function is reasonably straightforward.
This includes a namespace, a source code definition, and a function definition. I've mostly just used the template that Scaleway provided, and I really like how the zip_hash makes sure that any code change means that the function will be updated at terraform apply
.
I added also a frontend that could send a GET request and display the message. You can see it here. Try it out!
There's a notable cold start when it hasn't been called for some time. But that is understandable and frankly acceptable. After startup the function is fast enough. Some experiments might be warranted to gauge the cold starts.
What of the costs? Scaleway provides a tool to estimate the monthly costs.
If I compare the costs for 128 MB RAM with the AWS Lambda costs, it is in the same order of magnitude. The same requests that would cost 0.33 euro would cost about 0.46 USD.
There are also methods to put the function behind an API gateway, which of course would provide more security. The function can also be added to an IAM application, which would mean that it can access other Scaleway resources. But in order to do that, you need to add an API key to the runtime environment. Service roles do not exist, nor is there some other mechanism currently to directly authorize a function to carry out tasks for you. So again, IAM is the clear weak spot in the design. This is unfortunate: security should not be an afterthought in platform design.
But I am delighted in the speed with which I could set this up and make it work smoothly, and in Terraform!