Note

We are no longer onboarding new users to Citus Cloud on AWS. However, existing customers can continue to use Citus Cloud as they do today.

Formation API

Note

Cloud API access is available upon request. Open a support ticket to enable it for your account.

Citus Cloud provides an API to list, delete, and create formations within an organization. This is a convenient way to manage frequent formation changes.

Authentication

All formation API requests must include an authentication token. To get one, visit the tokens page, accessible through the Cloud menu bar in Org > API Tokens:

org menu

Create a token with a name that’s meaningful to you. The name does not affect the API, it exists so you can revoke the token later if desired. Tokens last for one year.

dialog to create token

After generating the token, its value will be displayed just once. Copy it to a secure place because it will never be visible again from the Cloud console.

In the examples below, we will assume that the token is assigned to an environment variable in the shell:

  1. # save to an environment variable for convenience
  2. export API_TOKEN=<token>

The token is in JWT format, and should be added to HTTPS requests using the Authorization header:

  1. Authorization: Token API_TOKEN

For security, all requests must be issued over https. Additionally, API requests are limited to five per minute.

Create Formation

  • Endpoint: POST https://console.citusdata.com/api/v1/formations/

  • Sample request payload:

    1. {
    2. "name": "my-formation",
    3. "region": "us-east-1",
    4. "tune_attributes": {
    5. "coordinator_tune": "t2.small",
    6. "worker_tune": "t2.small",
    7. "coordinator_ha": false,
    8. "worker_ha": false,
    9. "worker_count": "2",
    10. "coordinator_disk_size": "100",
    11. "worker_disk_size": "100"
    12. }
    13. }

    Parameters:

    • (mandatory) name: a non-empty string of your choice

    • (mandatory) region: any of our Supported Regions

    • (mandatory) coordinator_tune, worker_tune: a tune is any of these AWS machine types: t2.small, t2.medium, t2.large, r3.large, r3.xlarge, r3.2xlarge, r3.4xlarge, r3.8xlarge r4.large, r4.xlarge, r4.2xlarge, r4.4xlarge, r4.8xlarge, r4.16xlarge, r5.large, r5.xlarge, r5.2xlarge, r5.4xlarge, r5.12xlarge, r5.24xlarge, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, c5.xlarge, c5.2xlarge, c5.4xlarge, c5.9xlarge. (If you choose a tune from the t2.\ series, both the coordinator_tune and worker_tune must be same.)*

    • (mandatory) coordinator_disk_size, worker_disk_size: size in gigabytes. May be any of the values 100, 512, 1024, 1536, 2048, or 2560. (If you choose a tune from the t2.\ series, the disk size must be 100.)*

    • (mandatory) worker_count: numeric value less than or equal to 40

    • coordinator_ha, worker_ha: whether to enable High Availability. Default is false.

  • Example:

    1. curl -H "Authorization: Token $API_TOKEN" \
    2. -H "Content-Type: application/json" \
    3. --request POST \
    4. -d '{"tune_attributes": { "coordinator_tune": "t2.small", "worker_tune": "t2.small", "worker_count": "2", "coordinator_disk_size": "100", "worker_disk_size": "100"}, "name": "my-formation", "region": "us-east-1"}' \
    5. https://console.citusdata.com/api/v1/formations/
  • Response:

    1. {
    2. "id": "0123456789abcdef0123456789a"
    3. }

List Formations

  • Endpoint: GET https://console.citusdata.com/api/v1/formations/

  • Example:

    1. curl -H "Authorization: Token $API_TOKEN" \
    2. https://console.citusdata.com/api/v1/formations/
  • Response:

    1. {
    2. "formations": [
    3. {
    4. "id": "0123456789abcdef0123456789a",
    5. "name": "my-formation",
    6. "region": "us-east-1",
    7. "created_at": "2019-01-01T00:00:00Z"
    8. }
    9. ]
    10. }

    The id attribute identifies the formation and is required to destroy a formation or get its details.

Formation Details

  • Endpoint: GET https://console.citusdata.com/api/v1/formations/:formation_id

  • Example:

    1. curl -H "Authorization: Token $API_TOKEN" \
    2. https://console.citusdata.com/api/v1/formations/0123456789abcdef0123456789a
  • Response:

    1. {
    2. "id": "0123456789abcdef0123456789a",
    3. "name": "my-formation",
    4. "state": "steady",
    5. "region": "us-east-1",
    6. "created_at": "2019-01-01T00:00:00Z",
    7. "tune_attributes": {
    8. "is_mx": false,
    9. "is_zfs": false,
    10. "worker_ha": false,
    11. "worker_tune": "t2.small",
    12. "worker_disk_size": "100",
    13. "worker_count": 2,
    14. "coordinator_ha": false,
    15. "coordinator_tune": "t2.small",
    16. "coordinator_disk_size": "100"
    17. },
    18. "database_url": "postgres://foo:bar@host:5432/db?sslmode=require"
    19. }

    Possible states include: steady, creating, converging, ready, archiving, and archived.

Destroy Formation

  • Endpoint: DELETE https://console.citusdata.com/api/v1/formations/:formation_id

  • Example:

    1. curl -H "Authorization: Token $API_TOKEN" --request DELETE \
    2. https://console.citusdata.com/api/v1/formations/0123456789abcdef0123456789a
  • Response:

    1. {
    2. "success": true
    3. }