Create a VPC and subnet
A VPC is a private network with its own IP range, carved into subnets. This
guide creates one end to end: create the VPC, read the operation it returns,
then add a subnet inside it. The runnable examples target qibdo’s own
engine, where the platform provisions VPCs and subnets on the underlying network
fabric.
Before you begin
Section titled “Before you begin”- Authentication. Export an authenticated bearer token as
$QIBDO_API_TOKEN. See Authenticate a user and manage the session. - Permissions. Your identity needs permission to manage network resources (VPCs and subnets) in the target workspace. See the authorization model.
- Workspace and zone. Export the target
$WORKSPACE_IDand$ZONE_ID(both UUIDs).
1. Create the VPC
Section titled “1. Create the VPC”Creating a VPC is a POST to the VPC collection under the parent workspace. You
give it a name, an optional description, the zone to deploy into, and a cidr
block: an address and a prefix length. The call returns an operation that
records the request.
curl -X POST \ -H "Authorization: Bearer $QIBDO_API_TOKEN" \ -H "Content-Type: application/json" \ https://api.qibdo.example.com/network/v1/workspaces/$WORKSPACE_ID/engines/qibdo/vpcs \ -d '{ "zone_id": "'"$ZONE_ID"'", "name": "production", "description": "Primary production VPC", "cidr": { "address": "10.0.0.0", "prefix": 16 } }'The call completes synchronously. The response is an operation already marked
done, carrying the new VPC’s resource_id:
{ "id": "8f14e45f-cea1-4d4b-9b7e-1f0b3c2a9d04", "resource_id": "2b9d04e1-7c3a-4e85-bf21-6a0d9e4c1f72", "resource_type": "com.qibdo.cloud.network:vpc", "operation_type": "NETWORK_OPERATION_TYPE_CREATE", "status": "NETWORK_OPERATION_STATUS_DONE", "progress": 100, "errors": []}Capture the resource_id as your VPC ID:
export VPC_ID="2b9d04e1-7c3a-4e85-bf21-6a0d9e4c1f72"If the request fails a precondition, for example a duplicate name or an
exhausted quota, it returns an error status such as ALREADY_EXISTS or
RESOURCE_EXHAUSTED; read the message to see what went wrong. To re-read an
operation later, fetch it by its id:
curl -H "Authorization: Bearer $QIBDO_API_TOKEN" \ https://api.qibdo.example.com/network/v1/operations/8f14e45f-cea1-4d4b-9b7e-1f0b3c2a9d042. Create a subnet inside the VPC
Section titled “2. Create a subnet inside the VPC”A subnet’s cidr must be a subset of the VPC’s CIDR and must not overlap with
sibling subnets. Omit gateway_ip to let the system derive it from the CIDR.
curl -X POST \ -H "Authorization: Bearer $QIBDO_API_TOKEN" \ -H "Content-Type: application/json" \ https://api.qibdo.example.com/network/v1/workspaces/$WORKSPACE_ID/engines/qibdo/vpcs/$VPC_ID/subnets \ -d '{ "name": "web-tier", "description": "Public-facing web subnet", "cidr": { "address": "10.0.1.0", "prefix": 24 } }'This too returns an operation already marked done, carrying the new subnet’s
resource_id.
3. Confirm
Section titled “3. Confirm”List the VPCs in your workspace to confirm the VPC is live:
curl -H "Authorization: Bearer $QIBDO_API_TOKEN" \ https://api.qibdo.example.com/network/v1/workspaces/$WORKSPACE_ID/engines/qibdo/vpcsNext steps
Section titled “Next steps”- Review the address-model invariants in VPCs and subnets.