DigitalOcean Plugin
The CloudQuery DigitalOcean plugin pulls configuration from DigitalOcean.
Authentication
Set the following environment variables in your shell (with values from the previous steps):
DIGITALOCEAN_TOKEN
SPACES_ACCESS_KEY_ID
andSPACES_SECRET_ACCESS_KEY
Configuration
In order to get started with the DigitalOcean plugin, you need to create a YAML file in your CloudQuery configuration directory (e.g. named digitalocean.yml
).
The following example sets up the DigitalOcean plugin, and connects it to a postgresql destination:
kind: source
spec:
# Source spec section
name: digitalocean
path: cloudquery/digitalocean
version: "v3.0.3"
tables: ["*"]
destinations: ["postgresql"]
Query Examples
Find public facing spaces
-- public facing spaces are accessible by anyone, easily query which space is public facing in your account
SELECT bucket->>'Name',location,public FROM digitalocean_spaces WHERE public = true;
List Droplets with public facing ipv4 or ipv6
-- Find any droplets that have a public ipv6 or ipv4 IP
SELECT id, name, v4->>'ip_address' AS address_v4, v4->>'netmask' AS netmask_v4, v4->>'gateway' AS gateway_v4,
v6->>'ip_address' AS address_v6, v6->>'netmask' AS netmask_v6, v6->>'gateway' AS gateway_v6
FROM
(SELECT id,name,v4,NULL as v6 FROM digitalocean_droplets CROSS JOIN JSONB_ARRAY_ELEMENTS(digitalocean_droplets.networks->'v4') AS v4
UNION
SELECT id,name,NULL as v4,v6 FROM digitalocean_droplets CROSS JOIN JSONB_ARRAY_ELEMENTS(digitalocean_droplets.networks->'v6') AS v6) AS union_v46
WHERE v4->>'type' = 'public' OR v6->>'type' = 'public';
Last updated on November 28, 2022