datastax / astra-cli

Command Line Interface for DataStax Astra
https://awesome-astra.github.io/docs/pages/astra/astra-cli/
Apache License 2.0
31 stars 9 forks source link

Specify cloud provider during DB creation #53

Closed gstachni closed 1 year ago

gstachni commented 1 year ago

This feedback was captured using a feedback form on datastax.com

While trying to automate an astra db creation via astra CLI I noticed that there's no way to specify the cloud provider. I reviewed the documentation, as well as the help command and it doesn't seem to be a way to change the default cloud provider. Would be great to have an option to do that.

clun commented 1 year ago

Why the Cloud Provider is not an opion today

Technically speaking, as of today, the region identifier is enough to identify which cloud provider you are working with

astra db list-regions-serverless
+----------------+-------------------------+------------------------------------+
| Cloud Provider | Region                  | Full Name                          |
+----------------+-------------------------+------------------------------------+
| aws            | ap-east-1               | Asia Pacific (Hong Kong)           |
| aws            | ap-south-1              | Asia Pacific (Mumbai)              |
| aws            | ap-southeast-1          | Asia Pacific (Singapore)           |
| aws            | ap-southeast-2          | Asia Pacific (Sydney)              |
| aws            | eu-central-1            | Europe (Frankfurt)                 |
| aws            | eu-west-1               | Europe (Ireland)                   |
| aws            | sa-east-1               | South America (Sao Paulo)          |
| aws            | us-east-1               | US East (N. Virginia)              |
| aws            | us-east-2               | US East (Ohio)                     |
| aws            | us-west-2               | US West (Oregon)                   |
| azure          | australiaeast           | Australia East                     |
| azure          | canadacentral           | Canada Central (Toronto)           |
| azure          | centralindia            | Central India (Pune)               |
| azure          | eastus                  | US East                            |
| azure          | eastus2                 | US East 2 (Virginia)               |
| azure          | francecentral           | France Central                     |
| azure          | westeurope              | West Europe                        |
| azure          | westus2                 | US West (Washington)               |
| gcp            | asia-northeast1         | Asia Northeast1 (Tokyo, Japan)     |
| gcp            | asia-south1             | Mumbai, India                      |
| gcp            | australia-southeast1    | Sydney, Australia, APAC            |
| gcp            | europe-west1            | St. Ghislain, Belgium              |
| gcp            | europe-west2            | West Europe2 (London, England, UK) |
| gcp            | northamerica-northeast1 | Montreal, Quebec                   |
| gcp            | northamerica-northeast2 | Toronto, Ontario                   |
| gcp            | us-central1             | Council Bluffs, Iowa               |
| gcp            | us-east1                | Moncks Corner, South Carolina      |
| gcp            | us-east4                | Ashburn, Virginia                  |
| gcp            | us-west1                | The Dalles, Oregon                 |
| gcp            | us-west4                | US West (Las Vegas, USA)           |
+----------------+-------------------------+------------------------------------+
astra db list-regions-serverless --cloud gcp
+----------------+-------------------------+------------------------------------+
| Cloud Provider | Region                  | Full Name                          |
+----------------+-------------------------+------------------------------------+
| gcp            | asia-northeast1         | Asia Northeast1 (Tokyo, Japan)     |
| gcp            | asia-south1             | Mumbai, India                      |
| gcp            | australia-southeast1    | Sydney, Australia, APAC            |
| gcp            | europe-west1            | St. Ghislain, Belgium              |
| gcp            | europe-west2            | West Europe2 (London, England, UK) |
| gcp            | northamerica-northeast1 | Montreal, Quebec                   |
| gcp            | northamerica-northeast2 | Toronto, Ontario                   |
| gcp            | us-central1             | Council Bluffs, Iowa               |
| gcp            | us-east1                | Moncks Corner, South Carolina      |
| gcp            | us-east4                | Ashburn, Virginia                  |
| gcp            | us-west1                | The Dalles, Oregon                 |
| gcp            | us-west4                | US West (Las Vegas, USA)           |
+----------------+-------------------------+------------------------------------+

So a creation with -r region is technically enough to identify the cloud provider

astra db create my-new-db -r us-west4

Evolution Proposition

Beside the technical aspect of things maybe it would reinsure for the user to add the cloud provider option but under the hood, there is no use, and you still need the region name.

astra db create my-new-db --cloud gcp --region us-west4 

With error messages:

clun commented 1 year ago

Al righty

1/ A couple of new commands

For genericity and could help the user as well

astra db list-clouds
astra streaming list-clouds
Screenshot 2023-03-09 at 15 09 13
astra db list-regions-serverless --cloud aws
Screenshot 2023-03-09 at 15 09 44

2/ Implementation of cloud check

If you provide invalid cloud

db create invalid --cloud cumulonimbus --region us-east1
[ERROR] Invalid Cloud Provider value for 'cumulonimbus', valid options are aws, gcp and azure (InvalidCloudProviderException)
[ERROR] Try 'astra help <your_command>' to get help
[INFO]  Use astra db list-clouds or astra streaming list-clouds to list available cloud providers.

if you provide valid cloud with invalid region for that cloud

db create invalid --cloud aws --region us-east1
Screenshot 2023-03-09 at 15 22 20

if you do not provide any cloud...back to default behaviour

db create correct  --region us-east-1
Screenshot 2023-03-09 at 15 33 27
synedra commented 1 year ago

Shouldnt the free providers be flagged as such?  Sent from my iPhoneOn Apr 6, 2023, at 12:55 PM, Cedrick Lunven @.***> wrote: Closed #53 as completed.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

clun commented 1 year ago

I will create a dedicated ticket for this one.