simonw/graphql-scraper

Scrape Fly regions and vmsizes

simonw opened this issue · 3 comments

simonw commented

These can be had using the following GraphQL queries:

{
  platform {
    regions {
      code
      latitude
      longitude
      name
    }
  }
}
{
  platform {
    vmSizes {
      name
      cpuCores
      maxMemoryMb
      memoryGb
      memoryIncrementsMb
      memoryMb
      priceMonth
      priceSecond
    }
  }
}

These need an authenticated Fly API token.

simonw commented

I can create org-scoped tokens now. I'm going to create one for an org with nothing in it, called simonw-limited-api-tokens.

https://fly.io/dashboard/simonw-limited-api-tokens

flyctl tokens create org

Then select that org from the interactive list.

I've saved the token in a FLY_SIMONW_API_TOKEN secret on this repo.

simonw commented

This works:

curl -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $FLY_SIMONW_API_TOKEN" \
  -d '{"query":"{ platform { regions { code latitude longitude name } } }"}' \
  https://api.fly.io/graphql