Timescale
Connecting to Timescale Database from a DevZero workspace.
Comprehensive guide for connecting to a Timescale Database from your DevBox.
Architecture Diagram
Timescale is an open-source time-series SQL database optimized for fast ingest and complex queries. In this guide, we will walk you through the entire process of connecting your Timescale Database to your DevBox step by step.
Prerequisites
- Before you begin, create your account with Timescale and create a new organization.
- Follow the Connecting to AWS guide to set up the advertise routes for DevBox to access AWS Services. This is necessary since we will use a VPC peering with a timescale database service for a secure connection.
Existing Timescale Service
Step 1: Creating the Recipe for Workspace
You will need to create a Recipe in DevZero equipped with the necessary tools like psql
:
- Go to DevZero Dashboard and open the Recipes tab.
- Click on New Recipe and enter the recipe's name.
- Click on Create a recipe, and your recipe will be created.
- Replace the recipe yaml file with the snippet below:
- After editing the recipe, click on Save and Build.
- When the build is successful, click on Launch.
- With the recipe already selected, click on Launch and your workspace will be created.
Step 2: Creating the VPC
To make your connection secure, we need to create a VPC within the Timescale Infrastructure and then peer it to the AWS VPC:
- Go to Timescale Dashboard > VPC.
- Click on New VPC and enter the Region, Name and IP Range of the VPC.
- Click on Create and after creation, click on Add under VPC Peering column.
- Enter your AWS VPC details and click on Add connection.
Step 3: Configure Timescale Service Environment
Follow the below steps to connect to the database instance:
- Go to Timescale Dashboard > Services.
- Click on the Service you want to access.
- Click the Triple dot dialog menu in the top right corner.
- Choose the Change service environment option and go to the VPC tab.
- Select the VPC and click on Attach VPC.
Step 4: Connecting to the Database
Now, with everything set, you just need to use the connection string to access the database:
- Go to Timescale Dashboard > Services.
- Click on the Service you want to access.
- Scroll down and copy the connection string you see.
- Go to DevBox, paste the connection string, and enter the password when prompted:
New Timescale Workspace
If you need to make a new Timescale database and access it through DevBox, then follow the below steps:
Step 1: Creating the VPC
To make your connection secure, we need to create a VPC within the Timescale Infrastructure and then peer it to the AWS VPC:
- Go to Timescale Dashboard > VPC.
- Click on New VPC and enter the Region, Name and IP Range of the VPC.
- Click on Create, and after creation, click on Add under the VPC Peering column.
- Enter your AWS VPC details and click on Add connection.
Step 2: Creating a Timescale Service
- Go to Timescale Dashboard > Services.
- Click on New Service and pick your service type between Time Series and Analytics and Dynamic PostgreSQL.
- Choose the Region, Compute configuration, and Environment type.
- In the VPC section choose the vpc you justv created.
- Click on Create Service and your database service will be created.
Step 3: Creating the Recipe for Workspace
You will need to create a Recipe in DevZero equipped with the necessary tools like psql
:
- Go to DevZero Dashboard and open the Recipes tab.
- Click on New Recipe and enter the recipe's name.
- Click on Create a recipe, and your recipe will be created.
- Replace the recipe yaml file with the snippet below:
- After editing the recipe, click on Save and Build.
- When the build is successful, click on Launch.
- With the recipe already selected, click on Launch and your workspace will be created.
Step 4: Connecting to the Database
Now, with everything set, you just need to use the connection string to access the database:
- Go to Timescale Dashboard > Services.
- Click on the Service you want to access.
- Scroll down and copy the connection string you see.
- Go to DevBox, paste the connection string, and enter the password when prompted.