This document will walk you through the few steps needed to create a read replica without using the database portal UI. Overall, you will first have to install a CLI from our hosting partner, Aiven, connect to your database, and then dump the logs to a text file.

1.0 Connecting to the CLI

To access your account information via the CLI you need to take the following steps:

  1. Login to your Timescale Cloud Portal 

  2. Click on your user name in the top left corner

  3. Select the Authentication tab 

  4. Click Generate Token:

  5. Name the token CLI, and leave the rest blank

  6. Copy the token. You need to grab it on this screen, otherwise it is gone

  7. Paste it somewhere safe

Now you have the needed access token.

2.0 Install the Aiven CLI Client:  

python -m pip install aiven-client

NOTE: You will need python 2.7 or 3.4 installed installed on the box you are using.


Next, create the following directory:

  ~/.config/aiven/

And create the following file:  

 aiven-credentials.json 

Within that file, insert the following:

{
    "auth_token": "ABC1+123...TOKEN==",
    "user_email": "[email protected]"
}

Copy and paste the token we generated earlier between the quotes on the auth_token line and add your email address (of your account) on the user_email line.

Finally, save and close the file.

3.0 Confirm you have access to your cloud account

Now you should be able to test that you can access the account using a simple command:

avn project list

This should show you a list of projects and the clouds they reside on.



4.0 Create the read replica

Now you can create the replica using the command below...

avn service create <name_of_replica> --project <project ID> -t pg --plan <timescale-name of the plan you want to use> --cloud timescale-aws-us-east-1 -c pg_read_replica=true -c service_to_fork_from=<name of service to fork> -c pg_version=11

Here's another example of the template query above 

avn service create test1 --project support-50d0 -t pg --plan timescale-basic-100-compute-optimized --cloud timescale-aws-us-east-1 -c pg_read_replica=true -c service_to_fork_from=tsu-ch8 -c pg_version=11
Did this answer your question?