---
title: How to create and deploy a function with the Scaleway CLI
description: Deploy Serverless Functions using Scaleway's CLI with this detailed guide.
tags: functions cli deploy
dates:
  validation: 2025-09-17
  posted: 2021-08-18
---
import Requirements from '@macros/iam/requirements.mdx'


## Scaleway Command Line Interface Overview

[The Scaleway Command Line Interface (CLI)](https://github.com/scaleway/scaleway-cli) allows you to pilot your Scaleway infrastructure directly from your terminal, providing a faster way to administer and monitor your resources. Scaleway CLI is easy to set up and use, and an essential tool for operating efficiently in your cloud environment. The CLI provides many functionalities, including the ability to create and deploy Serverless Functions.

<Requirements />

- A Scaleway account logged into the [console](https://console.scaleway.com)
- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
- A valid [API key](/iam/how-to/create-api-keys/)
- [Installed and configured the Scaleway CLI](/scaleway-cli/quickstart/)

## Creating a function

1. Run the following command in your terminal to create a functions namespace:

    ```
    scw function namespace create name=<YOUR_NAMESPACE_NAME>
    ```

    An output similar to the following displays:

    ```
    ID                   6e74dbb7-9323-46bb-abc7-5c0105f4e70e
    Name                 <YOUR_NAMESPACE_NAME>
    OrganizationID       55e28409-776f-4f65-a41e-6c5fc58b4076
    ProjectID            55e28409-776f-4f65-a41e-6c5fc58b4076
    Status               pending
    RegistryNamespaceID  -
    RegistryEndpoint     -
    Description          -
    Region               fr-par
    ```

2. Run the following command in your terminal to create a function:

    ```
    scw function function create name=<FUNCTION_NAME> namespace-id=<NAMESPACE_ID> runtime=<YOUR_RUNTIME>
    ```

      An output similar to the following displays:

      ```
      ID              717fb5f9-95c3-4c0b-84db-2321283e46dc
      Name            <FUNCTION_NAME>
      NamespaceID     cee31af8-d43e-4078-8f55-c921a9311f47
      Status          created
      MinScale        0
      MaxScale        5
      Runtime         python310
      MemoryLimit     256
      CPULimit        140
      Timeout         5 minutes
      Handler         handler.handle
      Privacy         public
      Description     -
      DomainName      namespace0leshy-cli-fn-functionname.functions.fnc.fr-par.scw.cloud
      Region          fr-par
      HTTPOption      enabled
      RuntimeMessage  -
      ```

    <Message type="tip">
      Refer to [this page](/serverless-functions/reference-content/functions-runtimes/#available-runtimes) to see all the available runtimes.
    </Message>

3. Create a zip file containing your function's code by following [this procedure](/serverless-functions/how-to/package-function-dependencies-in-zip/).

    <Message type="note">
      For testing purposes, you can create a zip archive with a simple Python file named `handler.py` inside, that contains the following code:

      ```python
      def handle(event, context):
          return {
              "body": {
                  "message": 'Hello, world',
              },
              "statusCode": 200,
          }
      ```
    </Message>

## Deploying a function

1. Run the following command to deploy your function:

    ```
    scw function deploy name=<FUNCTION_NAME> namespace-id=<NAMESPACE_ID> runtime=<YOUR_RUNTIME> zip-file=path/to/archive/<ZIP_FILE>
    ```

    The deployment process can take up to three minutes.

2. Run the following command to call your function:

    ```bash
    curl <YOUR_FUNCTION_ENDPOINT>
    ```

    Your function is now deployed and ready to be used.
