|
| 1 | +--- |
| 2 | +meta: |
| 3 | + title: How to use Private Networks with your Serverless Containers |
| 4 | + description: This page explains how to use Private Networks for Scaleway Serverless Containers |
| 5 | +content: |
| 6 | + h1: How to use Private Networks with your Serverless Containers |
| 7 | + paragraph: This page explains how to use Private Networks for Scaleway Serverless Containers |
| 8 | +tags: private-networks private networks instance containers vpc |
| 9 | +dates: |
| 10 | + validation: 2025-06-25 |
| 11 | + posted: 2021-06-25 |
| 12 | +categories: |
| 13 | + - serverless |
| 14 | +--- |
| 15 | + |
| 16 | +[Private Networks](/serverless-containers/concepts/#private-networks) allow your Serverless Containers to communicate in an isolated and secure network without needing to be connected to the public internet. Each container can be connected to one or several Private Networks, letting you build your own network topologies. |
| 17 | + |
| 18 | +For full information about Scaleway Private Networks and VPC, see our [dedicated documentation](/vpc/) and [best practice guide](/vpc/reference-content/getting-most-private-networks/). |
| 19 | + |
| 20 | +<Message type="important"> |
| 21 | +The Private Networks feature can only be enabled on newly created namespaces. Existing namespaces that do not have the feature enabled cannot be integrated in a Private Network. |
| 22 | +</Message> |
| 23 | + |
| 24 | +<Macro id="requirements" /> |
| 25 | + |
| 26 | +- A Scaleway account logged into the [console](https://console.scaleway.com) |
| 27 | +- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization |
| 28 | +- [Created a Private Network](/vpc/how-to/create-private-network/) |
| 29 | + |
| 30 | + |
| 31 | +## How to create a Private Network |
| 32 | + |
| 33 | +This action must be carried out from the VPC section of the console. Follow the procedure detailed in our [dedicated VPC documentation](/vpc/how-to/create-private-network/). |
| 34 | + |
| 35 | +## How to create a Private Networks-enabled namespace |
| 36 | + |
| 37 | +Before attaching a Private Network to a Serverless Container, you must create it within a namespace with the Private Networks feature enabled. |
| 38 | + |
| 39 | +1. Click **Containers** in the **Serverless** section of the side menu. The containers page displays. |
| 40 | + |
| 41 | +2. Click **+ Create namespace**. If you have no existing Serverless Containers resources in your current Project, click **Create a container**. The containers namespace creation wizard displays. |
| 42 | + |
| 43 | +3. Complete the following steps in the wizard: |
| 44 | + - Enter a **name** or use the automatically generated one. The name can only contain lowercase alphanumeric characters and dashes. |
| 45 | + - Enter an optional **description** and **tags**. |
| 46 | + - Choose a **region**, which is the geographical location in which your namespace will be deployed. |
| 47 | + - Tick the **Enable VPC support** box. This parameter cannot be edited once the the namespace is created. |
| 48 | + - Click **+ Add advanced options** to define any **environment variables** you want to inject into your container. For each environment variable, click **+ Add variable** and enter the key/value pair. |
| 49 | + - Set optional secret environment variables. **Secrets** are environment variables which are injected into your container and stored securely, but not displayed in the console after initial validation. Add a **key** and a **value**. |
| 50 | +4. Click **Create namespace only** to finish, or click **Create namespace and add a container** if you want to [create a container](/serverless-containers/how-to/create-a-container/) next. |
| 51 | + |
| 52 | +## How to attach a Serverless Container to a Private Network |
| 53 | + |
| 54 | +<Tabs id="private-network-containers"> |
| 55 | + <TabsTab label="Existing container"> |
| 56 | + 1. Click **Containers** in the **Serverless** section of the side menu. The containers page displays. |
| 57 | + 2. Click the relevant containers namespace. |
| 58 | + 3. Click the name of the container you want to manage. |
| 59 | + 4. Open the **Settings** tab, then scroll to the **Advanced options** section. |
| 60 | + 5. In the **VPC** tab, select a Private Network from the dropdown menu. |
| 61 | + 6. Click **Save container settings**. |
| 62 | + |
| 63 | + Your container is redeployed, and is now attached to the selected Private Network. |
| 64 | +</TabsTab> |
| 65 | +<TabsTab label="New container"> |
| 66 | + 1. Click **Containers** in the **Serverless** section of the side menu. The containers page displays. |
| 67 | + 2. Click the **Private Networks-enabled** containers namespace in which you want to create your container. |
| 68 | + 3. Click **+ Create container**. The container creation wizard displays. |
| 69 | + 4. Scroll to the **Advanced options** section. |
| 70 | + 5. In the **VPC** tab, select a Private Network from the dropdown menu. |
| 71 | + 6. Configure the other parameters of your container, then click **Create container**. Refer to the [How to create a container](/serverless-containers/how-to/create-a-container/) for more information. |
| 72 | + |
| 73 | + Your new container is deployed, and is attached to the selected Private Network. |
| 74 | + </TabsTab> |
| 75 | +</Tabs> |
| 76 | + |
| 77 | +## How to detach a container from a Private Network |
| 78 | + |
| 79 | +1. Click **Containers** in the **Serverless** section of the side menu. The containers page displays. |
| 80 | +2. Click the relevant containers namespace. |
| 81 | +3. Click the name of the container you want to manage. |
| 82 | +4. Open the **Settings** tab, then scroll to the **Advanced options** section. |
| 83 | +5. In the **VPC** tab, click the <Icon name="unlink" /> icon next to the Private Network attached to your container. |
| 84 | +6. Click **Save container settings**. |
| 85 | + |
| 86 | +Your container is redeployed and is now detached from the Private Network. |
| 87 | + |
| 88 | +## How to delete a Private Network |
| 89 | + |
| 90 | +<Message type="note"> |
| 91 | + Before deleting a Private Network, you must [detach](/vpc/how-to/attach-resources-to-pn/#how-to-detach-a-resource-from-a-private-network) all resources attached to it. |
| 92 | +</Message> |
| 93 | + |
| 94 | +This must be carried out from the VPC section of the console. Follow the procedure detailed in our [dedicated VPC documentation](/vpc/how-to/delete-private-network/). |
0 commit comments