---
title: VPC Networks
url: https://docs.vultr.com/products/storage/databases/kafka/management/connection/vpc-networks
description: Learn how to attach, detach, and manage VPC networks for your Vultr Managed Apache Kafka® subscription for secure communication.
publish_date: 2024-10-16T12:45:26.677262Z
last_updated: 2026-05-26T20:37:40.214583Z
---

# How to Manage VPC Networks for Vultr Managed Apache Kafka®

Vultr Managed Apache Kafka® enables customers to attach or detach a VPC network to their Kafka subscription. Users can easily configure their network settings, allowing for secure and efficient communication between their Kafka database and other resources within the VPC. This straightforward interface provides customers with the flexibility to manage their network connections as needed, ensuring optimal performance and security for their data streaming operations.

Follow this guide to manage Vultr VPC Networks for Vultr Managed Apache Kafka® with Vultr Console, API, CLI, or Terraform.

=== "Vultr Console"

    1. Navigate to **Products** and select **Databases**.
    1. Select the target database.
    1. Navigate to **VPC Network** under **Overview**. 
    1. Select a network from the list and click **Update**.

=== "Vultr API"

    1. List all the databases by sending a `GET` request to the [**List Managed Databases** endpoint](https://www.vultr.com/api/#tag/managed-databases/operation/list-databases) and note the target database's ID.

        ```console
        $ curl "https://api.vultr.com/v2/databases" \
            -X GET \
            -H "Authorization: Bearer ${VULTR_API_KEY}"
        ```

    1. List all the VPC networks by sending a `GET` request to the [**List VPC Networks** endpoint ](https://www.vultr.com/api/#tag/VPCs/operation/list-vpcs) and note the target network's ID.

        ```console
        $ curl "https://api.vultr.com/v2/vpcs" \
            -X GET \
            -H "Authorization: Bearer ${VULTR_API_KEY}"
        ```

    1. Send a `PUT` request to the [**Update Managed Database** endpoint](https://www.vultr.com/api/#tag/managed-databases/operation/update-database) to attach the VPC network to the database by specifying the database ID and the VPC network's ID.

        ```console
        $ curl "https://api.vultr.com/v2/databases/<database-id>" \
            -X PUT \
            -H "Authorization: Bearer ${VULTR_API_KEY}" \
            -H "Content-Type: application/json" \
            --data '{
                "vpc_id" : "<vpc_network_id>"
            }'
        ```

    1. Detach a VPC network from the database by sending a `PUT` request to the [**Update Managed Database** endpoint](https://www.vultr.com/api/#tag/managed-databases/operation/update-database) and specify the database ID and an empty VPC ID.

        ```console
        $ curl "https://api.vultr.com/v2/databases/<database-id>" \
            -X PUT \
            -H "Authorization: Bearer ${VULTR_API_KEY}" \
            -H "Content-Type: application/json" \
            --data '{
                "vpc_id" : "<vpc_network_id>"
            }'
        ```

        Visit the [**Update Managed Database** endpoint](https://www.vultr.com/api/#tag/managed-databases/operation/update-database) to view additional attributes to add to your request.

=== "Vultr CLI"

    1. List all database instances and note the database ID. For instance, `d6ac2a3c-92ea-43ef-8185-71a23e58ad8c`.

        ```console
        $ vultr-cli database list --summarize
        ```

    1. List all VPC networks and note the VPC ID. For instance, `778dd77c-a581-43a8-94e6-75b6ceb4354a`.

        ```console
        $ vultr-cli vpc list
        ```

    1. Attach the VPC network by specifying the database ID and the VPC ID.

        ```console
        $ vultr-cli database update database_id \
        --vpc-id <vpc_id>
        ```    
        Run `vultr-cli database update --help` to view all options.

=== "Terraform"

    1. Open your Terraform configuration for the existing Managed Apache Kafka® resource.

    1. Attach a VPC by setting the `vpc_id` argument. To detach, set `vpc_id = null`.

        ```terraform
        resource "vultr_database" "kafka" {
            # ...existing fields (database_engine, region, plan, label, etc.)

            vpc_id = var.vpc_id  # e.g., "778dd77c-a581-43a8-94e6-75b6ceb4354a"
        }
        ```

        ```terraform
        # Detach VPC
        resource "vultr_database" "kafka" {
            # ...existing fields
            vpc_id = null
        }
        ```

    1. Apply the configuration and observe the following output:

        ```
        Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
        ```
