---
title: "Connect database to VPC"
method: POST
path: "/api/v1/databases/{database_id}/vpc"
tags: ["Managed Databases"]
---

# Connect database to VPC

`POST /api/v1/databases/{database_id}/vpc`

Attach a database created without a VPC to one of your VPCs. The private endpoint `{database_id}.db.raffusercloud.com` becomes reachable from inside that VPC.

## Path parameters

- `database_id` string, required

## Request body

- ConnectDatabaseVPCRequest
  - `vpc_id` string, uuid, required — VPC to attach the database's private endpoint to

## Response `200`

Database connected to the VPC

- object
  - `success` boolean
  - `database` Database — A managed database instance. The private endpoint `{database_id}.db.raffusercloud.com` lives inside the attached VPC; public access is optional. TLS is always required.
    - `id` string, uuid — Unique database identifier
    - `database_id` string — Short reference id used in URLs and DNS hostnames, e.g. `a1b2c3d4`
    - `project_id` string, uuid — Project this database belongs to
    - `name` string — Display name
    - `engine` 'postgres' | 'mysql' | 'valkey' | 'clickhouse' | 'kafka' — Database engine identifier. Defaults to `postgres` on create; the live catalog (including availability and versions) is `GET /api/v1/databases/engines`.
    - `engine_version` string — Engine major version
    - `status` 'pending' | 'deploying' | 'running' | 'warning' | 'suspended' | 'failed' | 'deleting' | 'deleted' — Lifecycle status. Creation: `pending` → `deploying` → `running`. `warning` means running with a degraded component; `suspended` means a free-tier database paused for idleness (resume any time — data is kept); `failed` means provisioning or a scale operation failed.
    - `status_message` string — Human-readable detail for `warning` and `failed` states
    - `region` 'us-east' — Data center region
    - `plan_id` integer — Pricing plan ID (see `GET /api/v1/databases/plans`)
    - `storage_gb` integer — Provisioned storage in GB. Storage above the plan's included allotment bills at $0.12/GB/month.
    - `ha_enabled` boolean — High availability — a standby that takes over automatically on failure (Sentinel failover for Valkey). Adds 70% of the plan price.
    - `replica_count` integer — Number of read replicas (PostgreSQL only; always 0 for Valkey)
    - `vpc_id` string, uuid — VPC the private endpoint is attached to (empty if not yet connected)
    - `public_access` boolean — Whether public access is enabled
    - `connection_host` string — Private endpoint hostname, resolvable inside the attached VPC
    - `connection_port` integer — Private endpoint port. PostgreSQL: 6432 pooled (PgBouncer, transaction mode), 5432 direct. Valkey: 6379 (TLS).
    - `billing_type` 'payg' | 'subscription' — Billing type for this database
    - `subscription_id` string, uuid — Subscription ID if billing_type is subscription
    - `price_per_hour` number — Hourly billing rate in USD
    - `monthly_price` number — Monthly price in USD
    - `public_port` integer — Public port from the reserved range 25060–26060; `0` when public access is off. For PostgreSQL, `public_port` is the pooled endpoint and `public_port + 1` is the direct endpoint.
    - `public_dns_hostname` string — Public endpoint hostname (empty when public access is off)
    - `public_allowlist` string[] — Source CIDRs allowed on the public endpoint. Empty = allow all sources.
    - `created_at` string, date-time
    - `updated_at` string, date-time

## Other responses

- `400` — Invalid request parameters
- `401` — Authentication required
- `404` — Resource not found

---

[API](https://skmtc.dev/rafftechnologies/apis/raff-api.md) · [All operations](https://skmtc.dev/rafftechnologies/apis/raff-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/rafftechnologies/raff-api/revisions/2f4df56be77c/schema)
