0

Is there any gcloud cli command or api call that I can use to see the latest/newest available PostgreSQL versions in region?

I found db-versions page, but I need to check which is the latest/newest available version programmatically.

1 Answers1

0

There is no a direct way to know this using gcloud CLI but I think the best (and awful) approach will be usign the help flag. Here are three versions so you can choose the one that could help you.

Version 1:

$ gcloud sql instances create --help | egrep -o '(MYSQL|POSTGRES)\w*'
MYSQL_5_5
MYSQL_5_6
MYSQL_5_7
POSTGRES_9_6
POSTGRES_11

Version 2:

$ gcloud sql instances create --help | egrep -o 'POSTGRES\w*'
POSTGRES_9_6
POSTGRES_11

Version 3:

$ gcloud sql instances create --help | egrep -o 'POSTGRES\w*' | egrep -o '_\w*' | sed -e 's/^.//' -e 's/_/./'
9.6
11

This versions will work assuming gcloud help is always updated.

Puteri
  • 268
  • 1
  • 7