400 Bad Request on Qovery API POST to Create cluster

Hello @Qovery_Team
Getting a 400 bad request on my API call to create a cluster. Any ideas why?
Are there any logs available in Qovery to help me troubleshoot?

curl --location --request POST 'https://api.qovery.com/organization/9c0338ef-ff2d-4924-a575-f8986cf6d7f5/cluster' \
--header 'Authorization: Token xxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
  "name": "my-customer",
  "description": "EC2 cluster for my-customer",
  "cloud_provider": "AWS",
  "min_running_nodes": 3,
  "max_running_nodes": 8,
  "disk_size": 20,
  "instance_type": "T3_LARGE",
  "kubernetes": "MANAGED",
  "production": true,
  "credentials": {
    "id": "xxx",
    "name": "xxxx"
  },
  "region": "us-west-2",
  "features": [
    {
        "value": false,
        "id": "STATIC_IP"      
    },
    {
         "value": "10.173.0.0/16",
         "id": "VPC_SUBNET"     
    }
  ]
}'

Hi @sama213 can you show the output please?

Out of curiosity: what’s your use case of using the REST API to create a cluster?

Hey @rophilogene ,
we need to automate the creation of a cluster as we will be scaling horizontally
I am getting no details just the 400 bad request.

image

@rophilogene
Get requests (ex: GET organization, get clusters) do work (so I know auth token is good, etc.).
This is still for some reason not working for me :frowning:
Do you have a sample request that I can use that is test and works?

Thanks!

Did you consider using Terraform instead of the REST API? You can take a look at those Terraform examples.

A valid request looks like this:

curl -H 'Content-type: application/json' -X POST -d \
'{\
"name": "prod cluster", \
"cloud_provider": "AWS", \
"region": "eu-west-3", \
"enable_static_ip": true\
}' -H "Authorization: Bearer YOUR_API_TOKEN" \
"https://api.qovery.com/organization/:yourOrgId/cluster"

Hey @rophilogene ,
the team we want to hand this postman collection over to does not have terraform knowledge and would be a big learning curve for them.

In the example you shared, you are not using credentials, or custom VPC settings, min/max nodes to instance type

Can you please help me with a more complete example for credentials and VPC subnet. I just need to define that template once and would appreciate any help I can get.

Also, I could not get authorization: Bearer xxx to work
I need to use Authorization: Token xxxx to work as a custom header value (tested on GET values).

Hey @rophilogene , figured out a workaround for now. Thanks!!!

1 Like