Update content

How to create a function

Reviewed on 02 January 2023Published on 26 May 2021

This page shows you how to deploy your first Scaleway Function. A function is a lightweight unit of logic, defining a procedure for changing one element into another. The function remains static, while the variables that pass through it can vary. The Scaleway Functions platform makes your function available, executes it on demand and manages resource allocation for you.

Security & Identity (IAM):

You may need certain IAM permissions to carry out some actions described on this page. This means:

  • you are the Owner of the Scaleway Organization in which the actions will be carried out, or
  • you are an IAM user of the Organization, with a policy granting you the necessary permission sets
Requirements:
  1. Click Functions in the Serverless section of the side menu. The functions page displays.
  2. Click the functions namespace you want to use to create your function.
  3. Click Create function. The function creation wizard displays.
  4. Complete the following steps in the wizard:
    • Enter your function code.
      • Set the handler for your function.
      • Choose your desired runtime and its version.
      • Choose to either use the inline code editor to edit your code directly from your browser in the box provided, or to upload a *.zip archive.
    • Choose a name for your function, and optionally a description. The name must only contain alphanumeric characters.
    • Choose the resources to be allocated to your function at runtime. These define the performance characteristics of your function.
    • Set your scaling preferences, or leave them at default values. The Scaleway platform autoscales the number of available instances of your function to match the incoming load, depending on the settings you define here.
    • Define any environment variables you want to inject into your function. For each environment variable, click +Add and enter the key/value pair.
    • Set secret environment variables (optional). Secrets are environment variables which are injected into your function and stored securely, but not displayed in the console after initial validation. Add a key and a value.
    • Set the desired privacy policy for your function. This defines whether a function can be executed anonymously (public) or only via an authentication mechanism provided by the Scaleway API (private).
    • Verify the estimated cost.
  5. Click Create function to finish.
Tip:

There are different ways to deploy Serverless Functions. Refer to our detailed deployment information for more advanced options to deploy your functions.

See Also