Virtual Private Clouds

Overview

You can use this guide to better understand how to create and manage a VPC via the StackPath API.

This guide complements the corresponding API reference for Virtual Private Clouds.

StackPath offers the following API calls:

  • Get all VPCs
  • Create a VPC
  • Get a VPC
  • Delete a VPC (patch)
  • Delete a VPC (delete)
  • Create a network route
  • Get all network routes
  • Update a network route
  • Get a network route
  • Delete a network route
  • Get all subnets
  • Get a subnet
  • Delete a subnet
  • Create a subnet
  • Update a subnet

📘

Note

To learn more , see Create and Manage a VPC Network.

Understand input parameters

Review the following table to understand how to make each API call.

API callDescriptionInput parameters
(GET) Get all VPCsThis call returns all VPCs for a specific stack.

You can use this call to obtain the network_id for a specific VPC, which you will need for other VPC-related API calls.
To use this call, you must enter a stack_id.

To obtain a stack_id, run the Get all stacks call.
(POST) Create a VPCThis call creates a new VPC.To use this call, you must enter a stack_id.

To obtain a stack_id, run the Get all stacks call.
(GET) Get a VPCThis call returns a specific VPC.To use this call, you enter a:
- stack_id
- network_id

To obtain a stack_id, run the (GET) Get all stacks call.

To obtain a network_id, run the (GET) Get all VPC networks call.
(PATCH) Delete a VPCThis call updates the name of a specific VPC.To use this call, you must enter a:
- stack_id
- network_id

To obtain a stack_id, run the (GET) Get all stacks call.

To obtain a network_id, run the (GET) Get all VPC networks call.
(DELETE) Delete a VPCThis call deletes a specific VPC.

You cannot delete a VPC that is assigned to a workload; you must first delete the workload, and then you can delete the VPC.
To use this call, you must enter a:
- stack_id
- network_id

To obtain a stack_id, run the (GET) Get all stacks call.

To obtain a network_id, run the (GET) Get all VPC networks call.
(POST) Create a network routeThis call creates a route between an existing source workload and an existing target workload.

To use this call, you must have at least 2 existing workloads.
To use this call, you must enter a:

- stack_id
- network_id

To obtain a stack_id, run the (GET) Get all stacks call.

To obtain a network_id, run the (GET) Get all VPC networks call.
(GET) Get all network routesThis call returns all routes associated with a specific VPC.To use this call, you must enter a:

- stack_id
- network_id

To obtain a stack_id, run the (GET) Get all stacks call.

To obtain a network_id, run the (GET) Get all VPC networks call.
(PUT) Update a network routeThis call updates a specific component of a specific route.To use this call, you must enter a:

- stack_id
- network_id
- route_id

To obtain a stack_id, run the (GET) Get all stacks call.

To obtain a network_id, run the (GET) Get all VPC networks call.

To obtain a route_id, run the (GET) Get all network routes call. n
(GET) Get a network routeThis call returns a specific route.To use this call, you must enter a:

- stack_id
- network_id
- route_id

To obtain a stack_id, run the (GET) Get all stacks call.

To obtain a network_id, run the (GET) Get all VPC networks call.

To obtain a route_id, run the (GET) Get all network routes call.
(DELETE) Delete a network routeThis call deletes a specific route.To use this call, you must enter a:

- stack_id
- network_id
- route_id

To obtain a stack_id, run the (GET) Get all stacks call.

To obtain a network_id, run the (GET) Get all VPC networks call.

To obtain a route_id, run the (GET) Get all network routes call.
(GET) Get all subnetsThis call retrieves all subnets for a specified network.To use this call, you must enter a:

- stack_id
- network_id

To obtain a stack_id, run the (GET) Get all stacks call.

To obtain a network_id, run the (GET) Get all VPC networks call.
(GET) Get a subnetThis call retrieves a specified subnet.To use this call, you must enter a:

- stack_id
- network_id
- subnet_id

To obtain a stack_id, run the (GET) Get all stacks call.

To obtain a network_id, run the (GET) Get all VPC networks call.

To obtain a subnet_id, run the (GET) Get all subnets in a network call.
(DELETE) Delete a subnetThis call deletes a specified subnet.To use this call, you must enter a:

- stack_id
- network_id
- subnet_id

To obtain a stack_id, run the (GET) Get all stacks call.

To obtain a network_id, run the (GET) Get all VPC networks call.

To obtain a subnet_id, run the (GET) Get all subnets in a network call.
(POST) Create a subnetThis call creates a subnet for a specific VPC.To use this call, you must enter a:

- stack_id
- network_id

To obtain a stack_id, run the (GET) Get all stacks call.

To obtain a network_id, run the (GET) Get all VPC networks call.
(PUT) Update a subnetThis call updates an existing subnet.To use this call, you must enter a:

- stack_id
- network_id
- subnet_id

To obtain a stack_id, run the (GET) Get all stacks call.

To obtain a network_id, run the (GET) Get all VPC networks call.

To obtain a subnet_id, run the (GET) Get all subnets in a network call.

Understand return values

Review the following table to understand specific data in the return.

API callDescription
(GET) Get all VPC networksThe return will display the network_id and slug_id for all VPC networks, which you will need for other VPC network-related API calls.
(POST) Create a VPC networkThe return will display the network_id and slug_id for the newly created VPC network, which you will need for other VPC network-related API calls.
(GET) Get all subnetsThe return will display the id for a specific subnet, which you will need for other subnet-related API calls.

Related documentation

To view API calls for VPC in the StackPath Developer Portal, see Virtual Private Cloud.

To view documentation regarding VPC in the StackPath Control Portal, see Create and Manage VPCs.