---
title: How to use security groups
description: Learn how to create, edit, and configure security groups on Scaleway Instances to control traffic and enhance security.
tags: security create instance traffic security-group
dates:
  validation: 2025-12-18
  posted: 2026-10-19
---

[Security groups](/en/docs/instances/concepts/#security-group) act as firewalls for your Instances. They let you create rules to drop or allow traffic, and can be stateful or stateless. You can apply a security group to an Instance to filter public traffic coming to and from the internet, or to a [Private Network interface](/en/docs/instances/concepts/#private-network-interface) to filter traffic coming to and from a Private Network, including traffic between Instances on the same Private Network. Private Network interfaces only accept stateful security groups.

This page explains how to create, edit, and configure a security group using the Scaleway console. See [Understanding security groups for Private Network interfaces](/en/docs/instances/reference-content/understanding-security-groups-private-network-interfaces/), for more information about filtering Private Network traffic.

## Before you start

To complete the following actions, you must have:

* A Scaleway account logged into the [console](https://console.scaleway.com)
* [Owner](/en/docs/iam/concepts/glossary/#owner) status or [IAM permissions](/en/docs/iam/concepts/glossary/#permission) allowing you to perform actions in the intended Organization
* An [Instance](/en/docs/instances/how-to/create-an-instance/)

## Create a security group

1. In the Scaleway console side menu, go to **Compute** > **CPU & GPU Instances**. The [Instances page](https://console.scaleway.com/instance/servers) opens.

2. Select an Availability Zone from the dropdown (for example, `fr-par-1`) to view the resources in this zone.

3. Click the **Security groups** tab. The list of your security groups appears.

   > **Note**
   >
   > The list contains at least one default security group. Scaleway creates a default security group in each [Availability Zone](/en/docs/instances/concepts/#availability-zone) where you create Instances. Instances in this Availability Zone use the default security group unless you select a different one. See [Stateful and stateless mode](#stateful-and-stateless-mode), for more information.

4. Click **+ Create security group**. The security group creation wizard opens.

5. Enter a **Name** for your security group, or keep the generated name. Optionally, enter a description.

6. Select an **Availability Zone**. You can only add Instances from this Availability Zone to the security group.

7. Define the inbound and outbound **rules** of the security group, and choose whether to enable SMTP ports. See [How to choose security group settings](#choose-security-group-settings), for more information.

8. Select the **CPU & GPU Instances** to add to the security group.

9. Click **Create security group**. The **Security groups** tab opens and displays your new security group.

## Edit a security group

1. In the Scaleway console side menu, go to **Compute** > **CPU & GPU Instances**. The [Instances page](https://console.scaleway.com/instance/servers) opens.
2. Select the Availability Zone of the security group from the dropdown.
3. Click the **Security groups** tab. The list of your security groups appears.
4. Click the security group you want to edit. Alternatively, click next to the security group, then click **More info**. The overview page of the security group opens.
5. Click the tab that contains the setting you want to edit.

The **Overview** tab lets you:

* Set or unset the security group as the default security group of the Project.
* Enable or disable SMTP for outgoing emails.
* Enable or disable stateful mode.
* Delete the security group.

The **Attached resources** tab lets you:

* View the resources the security group applies to. Click **Instances (public)** or **Private Network interfaces** to switch between the two lists.
* [Attach Instances or Private Network interfaces](#attach-resources-to-a-security-group) to the security group.
* [Detach resources](#detach-resources-from-a-security-group) from the security group.

The **Rules** tab lets you:

* Set the default inbound and outbound policies. Click , then select **Drop** or **Accept** for inbound and outbound traffic.
* Create, edit, or delete rules to accept or drop traffic from defined sources. Click , then click **Add inbound rule** or **Add outbound rule**. Define your rule, then click to confirm. See [Choose security group settings](#choose-security-group-settings), for more information.

## Attach resources to a security group

You can attach Instances and Private Network interfaces to a security group:

* When you attach an Instance, the security group filters the public traffic of the Instance.
* When you attach a Private Network interface, the security group filters the traffic of the Private Network interface. The security group must be [stateful](#stateful-and-stateless-mode). If the Private Network interface already has a security group, the new security group replaces it.

1. In the Scaleway console side menu, go to **Compute** > **CPU & GPU Instances**. The [Instances page](https://console.scaleway.com/instance/servers) opens.
2. Click the **Security groups** tab.
3. Click the security group you want to attach resources to. The overview page of the security group opens.
4. Click the **Attached resources** tab.
5. Click **+ Attach resource**. A dialog box appears.
6. Select the **Resource type**: **Instance** or **Private Network interface**.
7. Select the **Resource** to attach.
8. Click **Attach resource**. The resource appears in the list of attached resources.

> **Tip**
>
> You can also change the security group from the page of a Private Network interface. See [How to change the security group of a Private Network interface](/en/docs/instances/how-to/use-private-network-interfaces/#change-the-security-group-of-a-private-network-interface), for more information.

## Detach resources from a security group

1. In the Scaleway console side menu, go to **Compute** > **CPU & GPU Instances**. The [Instances page](https://console.scaleway.com/instance/servers) opens.
2. Click the **Security groups** tab.
3. Click the security group you want to detach resources from. The overview page of the security group opens.
4. Click the **Attached resources** tab.
5. Click **Instances (public)** or **Private Network interfaces** to show the type of resource you want to detach.
6. Click next to the resource you want to detach. A dialog box appears.
7. Click **Detach resource**. The resource disappears from the list of attached resources.

## Choose security group settings

### SMTP

Scaleway blocks SMTP ports by default to prevent email spam. As a result, you cannot send outgoing emails from your Instance. Scaleway recommends keeping this default setting unless you need to send emails from your Instance.

To enable or disable SMTP, [edit your security group](#edit-a-security-group) and check or uncheck the SMTP box in the **Overview** tab.

### Stateful and stateless mode

A security group is either stateful or stateless:

* **Stateless**: The security group evaluates each packet independently against your inbound and outbound rules. It does not track active connections, so you must create rules that allow both incoming and outgoing traffic for a connection to succeed. See [Stateless security groups](/en/docs/instances/concepts/#stateless-security-groups), for more information.
* **Stateful**: The security group tracks the state of active connections. If a rule allows a connection to start, the security group allows all return traffic for this connection, even if your default policy or another rule drops this traffic. See [Stateful security groups](/en/docs/instances/concepts/#stateful-security-groups), for more information.

Security groups you create in the console or with the CLI are stateful by default. The default security group that Scaleway creates when you launch your first Instance in an Availability Zone is stateless. This group does not allow return traffic: if your Instance starts an outbound connection, the security group drops the response unless you add a matching inbound rule or switch the group to stateful mode.

To enable or disable stateful mode, [edit your security group](#edit-a-security-group) and check or uncheck the stateful box in the **Overview** tab.

> **Important**
>
> Private Network interfaces only accept stateful security groups. Enable stateful mode before you attach a security group to a Private Network interface.

### Default inbound and outbound policies

Default policies apply to all traffic that no rule matches. You can set each default policy to accept or drop all inbound traffic, and accept or drop all outbound traffic. Scaleway recommends dropping inbound traffic by default to prevent intrusions.

To change the default policies, [edit your security group](#edit-a-security-group) and click in the **Rules** tab.

### Inbound and outbound rules

Rules let you accept or drop traffic for specific protocols, ports, and IP ranges. To create a rule, [edit your security group](#edit-a-security-group) and click in the **Rules** tab.

Define the following parameters for each rule:

* **Rule**: Select **Accept** to accept the connections that match the rule, or **Drop** to drop them.
* **Protocol**: Select the protocol the rule applies to: TCP, UDP, or ICMP.
* **Port**: Enter the port the rule applies to. Check the **All Ports** box to apply the rule to all ports.
* **IP Range**: Enter the IP range the rule applies to, in CIDR notation. For a security group attached to a Private Network interface, use private IP addresses, such as the CIDR block of the Private Network or the private IP address of a specific Instance.
