Serverless and Rust are some of the topics to motivate me for doing POC's as in real life projects these topics are still not common practice. An other topic currently handles the IT world is European Sovereign Cloud. One actor for this is https://www.scaleway.com
The perfect moment to create a new POC, and move my AWS Serverless project https://github.com/oxide-byte/todo-serverless to a new European Cloud Provider.
Objectives:
- Serverless Functions in Backend (Rust)
- S3 Static Web Pages in Frontend (Rust / Leptos)
- Serverless Database (PostgreSQL)
- IAC - OpenTofu / Terraform
ATTENTION:
Deploying this POC with it's functions and database generate costs !!!
*** RULE 1 ***
Apply MultiFactor Authentication (MFA) on your main account.
*** RULE 2 ***
Don't use your main account for daily business or POC's like this. It is easier to delete an "WORKER" account when its credentials are compromised. (https://www.scaleway.com/en/docs/iam/how-to/create-application/)
*** RULE 3 ***
Don't commit productive/cloud accounts, keys or passwords.
*** RULE 4 ***
Define your Budget plan with alerts:
*** RULE 5 ***
Clean up when finished. Remove all unused resources.
Creating a new account on https://www.scaleway.com
Sample of prices:
- https://www.scaleway.com/en/pricing/containers/
- https://www.scaleway.com/en/pricing/serverless/
- https://www.scaleway.com/en/pricing/managed-databases/#serverless-sql-database
Installation: https://www.scaleway.com/en/cli/
The current applied user has in my case organizational Administration rights and a policy to all products. To review later, as maybe in real organizations not all actions are done by Terraform/OpenTofu but by an administrator.
as mentioned, I use OpenTofu / Terraform
*** Initial Environment ***
export TF_VAR_access_key=<scw-access-key>
export TF_VAR_secret_key=<scw-secret-key>
export TF_VAR_project_id=<scw-project-id>
export TF_VAR_organization_id=<scw-organization-id>The Terraform script manages the following Scaleway resources:
- Serverless SQL Database: A PostgreSQL database (v16) for task storage.
- IAM Application & API Key: Secure, scoped authentication for the database (using
ServerlessSQLDatabaseReadWritepolicy). - Container Namespace & Registry: Infrastructure to host and store the serverless function images.
- Serverless Containers (FaaS): Five Rust-based functions (
add,delete,get,get-all,edit) that handle the API logic. - Object Storage (S3): A bucket configured for static website hosting to serve the Leptos-based UI.
- Initialization Scripts: Automated Docker builds, database schema setup, and UI deployment via
local-execprovisioners.
*** The OpenTofu commands ***
cd iac
tofu inittofu plantofu applytofu destroyThe created Serverless Containers:
The serverless Database:
The OpenTofu scripts shows
adding to the website_url /index.html access you to the website:
- https://github.com/scaleway/serverless-examples/blob/main/containers/rust-hello-world/README.md
- https://www.scaleway.com/en/docs/tutorials/nextjs-app-serverless-functions-sqldb/
- https://www.scaleway.com/en/docs/tutorials/nextjs-app-serverless-functions-sqldb/#deploy-a-next.js-application-using-terraform-templates
- https://www.scaleway.com/en/docs/ai-search/
This is a simple POC, there is still room for improvements.
This application has 5 functions (add/delete/edit/get/get_all), but could be joined in a single one. This is only for showcase. A single function would reduce cold starts. The advantage of multiple functions, you could define each function a different CPU/Memory value with different execution costs.







