NavigationContentFooter
Jump toSuggest an edit

How to attach resources to a Private Network

Reviewed on 02 April 2024Published on 21 March 2023

VPC allows you to build your own Virtual Private Cloud on top of Scaleway’s shared public cloud. Within each VPC, you can create multiple Private Networks and attach Scaleway resources to them, as long as the resources are in an AZ within the network’s region. Attached resources can then communicate between themselves in an isolated and secure layer 2 network, away from the public internet.

Private Networks also have built-in Dynamic Host Configuration Protocol (DHCP), making it easy to manage the private IP addresses of your resources on the network.

Up to 512 resources can be attached to each Private Network, and each resource can be attached to up to eight Private Networks.

The following resource types can be attached to a Private Network:

  • Instances
  • Elastic Metal servers
  • Load Balancers
  • Public Gateways
  • Managed Databases for PostgreSQL and MySQL
Note

Kubernetes Kapsules and Managed Databases for Redis™ are also compatible with Private Networks, but they can only be attached to a Private Network at the time of creating the resource. It is not possible to attach a cluster or Redis™ database to a Private Network after its creation, or change the attached Private Network.

Before you start

To complete the actions presented below, you must have:

  • A Scaleway account logged into the console
  • Owner status or IAM permissions allowing you to perform actions in the intended Organization
  • Created a Private Network
  • Created at least one Scaleway resource in the same region as your Private Network

How to attach a resource to a Private Network

  1. Click VPC in the Network section of the side menu. Your VPC dashboard displays:

  2. Click the VPC containing the Private Network to which you want to attach a resource.

    A list of Private Networks in this VPC displays:

  3. Click the Private Network to which you want to attach a resource.

    The Private Network’s dashboard displays.

  4. Click the Attached resources tab.

    If you already have resources attached to the Private Network, a list of these displays. Otherwise, you see a welcome screen.

  5. Click + Attach resource. The following screen displays.

  6. Select the type of resource (Instance, Elastic Metal server etc.) that you want to attach. Then select the specific resource to attach. Only resources within the same region (or one of its Availability Zones) as the Private Network will be displayed.

  7. Click Attach resource to finish.

    You are returned to the list of attached resources, where the newly-attached resource now displays.

Tip

You can also attach a resource to a Private Network from the resource’s own section of the console. Follow the relevant steps below:

  • Instance
  • Elastic Metal server
  • Managed Database for PostgreSQL and MySQL
  • Load Balancer
  • Public Gateway

Note that for Kubernetes Kapsules and Managed Databases for Redis™, you can only attach the resource to a Private Network at the time of creating the resource itself.

How to view the resource’s IP address

When you attach a resource to a Private Network, it is automatically assigned an IPv4 and IPv6 address on that network. This is assigned from the CIDR block defined at the time of the Private Network’s creation.

The IP allocated when you attach the resource remains stable for as long as the resource is attached to the Private Network, and does not risk changing even across reboots and long poweroffs. The IP is lost only when you delete the resource or detach it from the Private Network.

You can view a resource’s IPv4 or v6 address in the Attached Resources tab of the Private Network itself (follow steps 1 - 5 above).

It can also be viewed via the Private Networks tab of the resource’s own dashboard.

Tip

Refer to our documentation on IPv4, IPv6 and CIDR blocks for further information about these concepts.

Important

When you attach an Instance or Elastic Metal server to a legacy Private Network on which you have not activated DHCP, no IP address is configured or shown on the screen shown above.

You will need to carry out manual configuration to set the IP address on the resource, or activate DHCP.

We strongly recommend that you activate DHCP on the Private Network to let us automatically handle IP address management.

If you do not see an IP address in the screens above for your resource, and you think you should, check out our troubleshooting guide.

Note that in any case, for Elastic Metal servers, some manual configuration is required even after activating DHCP. This is not required for Instances or other types of resources.

How to access a resource on a Private Network via its hostname (DNS)

In addition to using its IP address, you can also access a resource on a Private Network via its hostname, thanks to VPC’s inbuilt private DNS.

A resource’s hostname is equivalent to the name you gave the resource when creating it. For example, if you have an Instance with the name instance123 attached to a Private Network named prodpn, its address on that network is instance123.prodpn.

Tip
  • If you update the resource’s name after creating it, and thus its hostname changes, it will not be automatically updated on our DNS records unless you detach and reattach the resource to the Private Network.

  • If you created the resource via the API, and it has dots in its name, these dots should be replaced by dashes for the purposes of DNS resolution (my.instance —> my-instance)

  • You can also reach a resource via its resource ID (with or without dashes), e.g. e49902a6-ed4c-431f-bd62-0fc41063eec0.prodpn

If you are still having problems reaching a resource attached to a Private Network via its hostname, see our troubleshooting guide.

How to detach a resource from a Private Network

  1. Click VPC in the Network section of the side menu.

  2. Click the VPC containing the Private Network from which you want to detach a resource.

    A list of Private Networks in this VPC displays.

  3. Click the Private Network from which you want to detach a resource.

  4. Click the Attached resources tab.

    A list of resources attached to the Private Network displays.

  5. Click the «Unlink Icon» icon next to the resource you want to detach.

  6. Click Detach resource when prompted to confirm.

Tip

You can also detach a resource to a Private Network from the resource’s own section of the console.

See also
How to activate DHCP on a legacy Private NetworkHow to manage routing on a VPC
Docs APIScaleway consoleDedibox consoleScaleway LearningScaleway.comPricingBlogCarreer
© 2023-2024 – Scaleway