export TOKEN=yourtoken
Display DO available droplet sizes
API Link
curl -ss -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" "https://api.digitalocean.com/v2/sizes?page=1&per_page=500&type=distribution" | jq '.sizes[] | { slug: .slug, cpu: .vcpus, memory: .memory, disk: .disk, transfer: .transfer, pricePerMonth: .price_monthly, pricePerHour: .price_hourly } '
curl -ss -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" "https://api.digitalocean.com/v2/sizes?page=1&per_page=500&type=distribution" | jq '.sizes[] | select(.price_monthly | contains(10)) | { slug: .slug, cpu: .vcpus, memory: .memory, disk: .disk, transfer: .transfer, pricePerMonth: .price_monthly, pricePerHour: .price_hourly } '
curl -ss -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" "https://api.digitalocean.com/v2/sizes?page=1&per_page=500&type=distribution" | jq '.sizes[] | select(.price_monthly < 100) | { slug: .slug, cpu: .vcpus, memory: .memory, disk: .disk, transfer: .transfer, pricePerMonth: .price_monthly, pricePerHour: .price_hourly } '
Sizes that have 8 GB memory
curl -ss -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" "https://api.digitalocean.com/v2/sizes?page=1&per_page=500&type=distribution" | jq '.sizes[] | select(.memory == (8 * 1024)) | { slug: .slug, cpu: .vcpus, memory: .memory, disk: .disk, transfer: .transfer, pricePerMonth: .price_monthly, pricePerHour: .price_hourly } '
again, formatted as table
curl -ss -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" "https://api.digitalocean.com/v2/sizes?page=1&per_page=500&type=distribution"
| jq -r '["SLUG","CPUs", "MEMORY", "DISK", "TRANSFER", "monthly", "hourly"],
(.sizes[] | select(.memory == (8 * 1024) and (.slug|length > 3))
| [.slug, .vcpus,.memory,.disk, .transfer, .price_monthly, .price_hourly ])| @tsv'
Query DO API to display all CentOS image slugs
curl -ss -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" "https://api.digitalocean.com/v2/images?page=1&per_page=500&type=distribution"| jq '.images[] | select(.distribution | contains("CentOS")) | { id: .id, name: .name, dist: .distribution, slug: .slug } '
Query DO API to display all image slugs
curl -ss -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" "https://api.digitalocean.com/v2/im
ages?page=1&per_page=500&type=distribution"| jq '.images[] | select(.distribution) | { id: .id, na
me: .name, dist: .distribution, slug: .slug } '
Query DO API to display all SSH Public Keys' fingerprints
curl -ss -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" "https://api.digitalocean.com/v2/account/keys" | jq '.ssh_keys[] | { name: .name , fingerprint: .fingerprint }'