diff --git a/serverless/functions/how-to/create-a-function.mdx b/serverless/functions/how-to/create-a-function.mdx index 44d63a1dfc..95d74784c2 100644 --- a/serverless/functions/how-to/create-a-function.mdx +++ b/serverless/functions/how-to/create-a-function.mdx @@ -23,25 +23,32 @@ This page shows you how to deploy a [function](/serverless/functions/concepts/#f 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. + +2. Click the functions namespace in which you want 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. + - Choose your function's runtime. + - Select **Deploy "Hello world"** if you want to deploy a basic function, **Inline code editor** to enter your own function code, or **Upload a ZIP** to import a [packaged function](/serverless/functions/how-to/package-function-dependencies-in-zip/). + - If you used the code editor, enter the **handler** of your function. + - Enter a **name** or use the automatically generated one. The name can only contain lowercase alphanumeric characters and dashes. + - Enter a **description** (optional). + - Select the **resources** to allocate to your function. + - Configure the **scaling** of your function. + + Define a minimum of 1 instance or more to avoid cold starts. + +5. Click **+ Advanced options** and complete the following steps: + - Define any **environment variables** you want to inject into your function. For each environment variable, click **+ Add variable** 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](https://www.scaleway.com/en/developers/api/serverless-functions/#authentication) (**private**). - - Click **Advanced Options** if you wish to set a custom timeout for your function. - - [Triggers](/serverless/functions/concepts/#trigger) can no longer be added from this screen. For more information, refer to the [How to add a trigger to a function](/serverless/functions/how-to/add-trigger-to-a-function/) documentation. - + - Set the desired timeout for your function. + + [Triggers](/serverless/functions/concepts/#trigger) can no longer be added from this screen. For more information, refer to the [How to add a trigger to a function](/serverless/functions/how-to/add-trigger-to-a-function/) documentation. + - Verify the **estimated cost**. -5. Click **Create function** to finish. +6. Click **Create function** to finish. There are different ways to deploy Serverless Functions. Refer to our detailed [deployment information](/serverless/functions/reference-content/deploy-function/) for more advanced options to deploy your functions. diff --git a/serverless/functions/how-to/create-a-functions-namespace.mdx b/serverless/functions/how-to/create-a-functions-namespace.mdx index 0345ad5c33..d952577257 100644 --- a/serverless/functions/how-to/create-a-functions-namespace.mdx +++ b/serverless/functions/how-to/create-a-functions-namespace.mdx @@ -24,16 +24,16 @@ This page shows you how to create your a functions namespace using the Scaleway 1. Click **Functions** in the **Serverless** section of the side menu. The functions page displays. -2. Click **Create namespace**. The functions namespace creation wizard displays. -3. Complete namespace information: - - **Name** of your namespace. The first character of your namespace must be a letter. It can only contain letters, numbers, and dashes. No other special characters are permitted. The namespace is case-sensitive and cannot be edited after its creation. - - **Description** (optional). - - **Region** is the geographical location in which your namespace will be deployed. - - **Environment variables** (optional) are key/value pairs that will be available in your functions as environment variables. - - **Secrets** (optional) are environment variables which are injected into your function and stored securely, but not displayed in the console after initial validation. -4. Click **Create namespace** to finish. - -Your namespace is now created and you are redirected to the **Functions** tab. + +2. Click **+ Create namespace**. If you have no existing Serverless Functions resources in your current Project, click **Create a function**. The functions namespace creation wizard displays. + +3. Complete the following steps in the wizard: + - Enter a **name** or use the automatically generated one. The name can only contain lowercase alphanumeric characters and dashes. + - Enter a **description** (optional). + - Choose a **region**, which is the geographical location in which your namespace will be deployed. + - Define any **environment variables** you want to inject into your function. For each environment variable, click **+ Add variable** and enter the key/value pair. + - Set your 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**. +4. Click **Create namespace only** to finish, or click **Create namespace and add a function** if you want to [create a function](/serverless/functions/how-to/create-a-function/) next. How to manage a Serverless Functions namespace diff --git a/serverless/functions/quickstart.mdx b/serverless/functions/quickstart.mdx index af9b02b0c3..220221e6f3 100644 --- a/serverless/functions/quickstart.mdx +++ b/serverless/functions/quickstart.mdx @@ -7,7 +7,7 @@ content: paragraph: This page shows you how to get started with Scaleway Functions tags: functions namespace dates: - validation: 2023-07-04 + validation: 2023-09-07 posted: 2021-05-26 categories: - serverless @@ -15,7 +15,7 @@ categories: Scaleway's [Serverless Functions](https://www.scaleway.com/en/serverless-functions/) platform makes your [functions](/serverless/functions/concepts/#function) available, executes them on demand and manages resource allocation for you. -This page explains how to deploy, invoke and delete a basic Python function using the Scaleway console. For advanced usage, such as larger projects with dependencies, automation, multiple functions and more, [many ways to deploy functions](/serverless/functions/reference-content/deploy-function/) are available. +This page explains how to deploy, invoke and delete a basic Node, Python, or PHP function using the [Scaleway console](https://console.scaleway.com). For advanced usage, such as larger projects with dependencies, automation, multiple functions and more, [many ways to deploy functions](/serverless/functions/reference-content/deploy-function/) are available. Check out our [scaleway/serverless-examples repository](https://github.com/scaleway/serverless-examples) for advanced examples and use cases. @@ -26,43 +26,40 @@ Check out our [scaleway/serverless-examples repository](https://github.com/scale - You have [cURL](https://everything.curl.dev/get) installed. -## How to create a functions namespace - -1. Click **Functions** in the **Serverless** section of the side menu. The functions page displays. -2. Click **+ Create namespace**. The functions namespace creation wizard displays. -3. Complete the following steps in the wizard: - - Enter a **name** and optionally a **description** for your namespace. The name must start with a letter and can only contain lowercase alphanumeric characters and dashes. - - Choose a **region**, which is the geographical location in which your namespace will be deployed. -4. Click **Create namespace** to finish. +## How to create a function -Your namespace is now created, and you are taken to its **Functions** tab. +If you have no existing Serverless Functions resources in your current Project, the creation process will guide you through the creation of a namespace, and then a function. - - Refer to the [How to create a Functions namespace](/serverless/functions/how-to/create-a-functions-namespace/) documentation page for more information on the different parameters. - +1. Click **Functions** in the **Serverless** section of the side menu. The functions page displays. -## How to create a function +2. Click **+ Create a function**. The functions [namespace](/serverless/functions/concepts/#namespace) creation wizard displays. -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. Enter your **function code**: - - Leave the `handler.handle` default value. +3. Complete the following steps in the wizard: + - Enter a **name** or use the automatically generated one. The name can only contain lowercase alphanumeric characters and dashes. + - Enter a **description** (optional). + - Choose a **region**, which is the geographical location in which your namespace will be deployed. +4. Click **Create namespace and add function**. The function creation wizard displays. + + Refer to the [How to create a Functions namespace](/serverless/functions/how-to/create-a-functions-namespace/) documentation page for more information on the different parameters. + +5. Complete the following steps in the wizard: - Choose either **Node**, **Python** or **PHP** as a runtime. - - Leave the default code sample in the editor. - - Choose a **name** for your function, and optionally a **description**. The name can only contain lowercase alphanumeric characters and dashes. + - Select **Deploy "Hello world"** if you want to deploy a basic function, or select **Inline code editor** to enter your own function code. + - If you used the code editor, enter the **handler** of your function. + - Enter a **name** or use the automatically generated one. The name can only contain lowercase alphanumeric characters and dashes. + - Enter a **description** (optional). - Choose the smallest **resources** available to allocate to your function. - - Leave the default **scaling** values. The Scaleway platform automatically scales the number of available instances of your function to match the incoming load, depending on the settings you define here. - - Set the **Function privacy policy** to public. + - Leave the default **scaling** values. + - In the **Advanced options**, set the **Function privacy policy** to **public**. - Verify the **estimated cost**. - Refer to the [How to create a function](/serverless/functions/how-to/create-a-function/) documentation page for more information on the different parameters. +6. Click **Create function**. The deployment takes several minutes to complete. Check the **Overview** tab to see the function's status. -5. Click **Create function**. The deployment will take several minutes to complete. Check the **Overview** tab to see the function's status. -6. Copy the function's endpoint URL from the **Overview** tab. -7. Run the following command in your terminal to invoke your function once it is deployed: +7. Copy the function's endpoint URL from the **Overview** tab. + +8. Run the following command in your terminal to invoke your function once it is deployed: ```bash curl @@ -71,8 +68,11 @@ Your namespace is now created, and you are taken to its **Functions** tab. ## How to delete a function 1. Click **Functions** in the **Serverless** section of the side menu. The functions page displays. + 2. Click the relevant functions namespace. + 3. Click the icon next to the function you want to delete, and select **Delete** from the dropdown menu. + 4. Type **DELETE** in the pop-up that asks you to confirm the action, then click **Delete function**.